[Lazarus] Color thief

Michael Van Canneyt michael at freepascal.org
Wed Jul 8 17:36:49 CEST 2015



On Wed, 8 Jul 2015, aradeonas wrote:

> Thank you.
>  
> I get exception when try to load from file and I could not debug in FPC source,debugger don't go there:
>  
>       var
>   i: Integer;
>   Img: TFPCustomImage;
>   reader: TFPCustomImageReader;
> begin
>   Img := TFPCustomImage.Create(0, 0);
>   Reader := TFPReaderJPEG.Create;
>   img.LoadFromFile('E:\photo1.jpg',Reader);
>   img.UsePalette := True;
>   for i := 0 to img.Palette.Count do
>   begin
>     with TPanel.Create(Self) do
>     begin
>       Parent := Self;
>       Align := alTop;
>       Color:=FPColorToTColor(img.Palette.Color[i]);
>     end;
>   end;
> end;  

What is the exception you get ?

The loading should go automatically, provided you have included the necessary reader files (fpreadjpeg.pas) in your uses clause.

Michael.


More information about the Lazarus mailing list