Sebastian Kraft wrote:

Hi,

I have the following code to load a jpeg from file test.jpg

var FImg: TFPMemoryImage;
        FImgReader: TFPReaderJpeg;

FImg:=TFPMemoryImage.create(0, 0);
FImgReader:=TFPReaderJPEG.Create;
FImg.LoadFromFile('test.jpg', FImgReader);

But the program hangs at loading the jpeg from the file. There is no AV, it just hangs and does nothing....
How do I have to load the jpeg correctly?
The problem here is the palette. A standard FPImage will use a palette to store its colors, jpeg does not. It is still converting each pixel's color to an index in the palette it creates on the fly.

Place the following line before loading the jpeg:

FImg.UsePalette := false;

And the loading will be almost instant.

Luk

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to