Page 1 of 1

New feature 'Scale' for jpeg reading

Posted: Tue Nov 02, 2004 12:05 pm
by Guest
Hi.

Jpeg thumbnail can be very fast reading with scaling (1:2, 1:4, 1:8, 1:16). Unluckily libgfl doesn't use this possibility. Is possible to add such new field into GFL_LOAD_PARAMS structure (exemplary GFL_JPEG_SCALE)and new feature for jpeg file reading? It's very useful for thumbnails list etc.

Re: New feature 'Scale' for jpeg reading

Posted: Tue Nov 02, 2004 12:46 pm
by xnview
Anonymous wrote:Jpeg thumbnail can be very fast reading with scalling (1:2, 1:4, 1:8, 1:16). Unluckily libgfl doesn't use this possibility. Is possible to add such new field into GFL_LOAD_PARAMS structure (exemplary GFL_JPEG_SCALE)and new feature for jpeg file reading? It's very useful for thumbnails list etc.
When you load jpeg thumbnail, i use the more closed scale factor.

Posted: Wed Nov 03, 2004 2:14 pm
by Guest
Hmm.... maybe in GflLoadThumbnail is a bug? My program, when I use directly TJpegImage component (from Delphi) read 58 jpegs (2048x156 px) as thumbnails (100x100 px) in 13 seconds. Using GflLoadThumbnail read this files in 31 seconds :(

Posted: Wed Nov 03, 2004 2:42 pm
by xnview
Anonymous wrote:Hmm.... maybe in GflLoadThumbnail is a bug? My program, when I use directly TJpegImage component (from Delphi) read 58 jpegs (2048x156 px) as thumbnails (100x100 px) in 13 seconds. Using GflLoadThumbnail read this files in 31 seconds :(
But with the same thumbnail size?

Posted: Thu Nov 04, 2004 10:01 am
by Guest
xnview wrote:But with the same thumbnail size?
Yes, all is identical, One and only difference is in file reading:
Original files are JPEG 2048x1536 px (or 1536x2048).

// gflLoadThumbnail(PChar(filename), w, h, gfl_bmp, lp, finfo);
// w:=120, h:=120; work 350-520 milliseconds


My subprocedure (in Delphi only, without GFL):
//(...)
Thumb.LoadFromFile(FileName);
if Thumb is TJPEGImage then
begin
TJPEGImage(Thumb).Scale := jsEighth; // look delphi help - below
TJPEGImage(Thumb).Performance := jpBestSpeed;
Result:=true;
end;
BMP := bmpScaling(Thumb, w, h);
// w:=120, h:=120; 90-150 milliseconds


Pozdrawiam, regards
------------------------
Description of TJPEGImage.Scale property from Delphi 6 Help:

Determines the size of the JPEG image when it is displayed.
Use Scale to optimize performance for previewing an image. jsFullSize displays the image as maximum size, whereas jsEighth displays an eighth of the image size, but 8 times faster.
TJPEGScale is the type of the Scale property. The following table lists the values of TJPEGScale:

Value Meaning
jsFullSize Displays a full-sized image.
(...)
jsEighth Displays an eighth-size image in an eighth of the time it takes to display a full-sized image.

Scale it used for reading in files, that is, for decompression.
------------------------

Posted: Thu Nov 04, 2004 12:22 pm
by xnview
Anonymous wrote:
xnview wrote:But with the same thumbnail size?
Yes, all is identical, One and only difference is in file reading:
Original files are JPEG 2048x1536 px (or 1536x2048).

// gflLoadThumbnail(PChar(filename), w, h, gfl_bmp, lp, finfo);
// w:=120, h:=120; work 350-520 milliseconds


My subprocedure (in Delphi only, without GFL):
//(...)
Thumb.LoadFromFile(FileName);
if Thumb is TJPEGImage then
begin
TJPEGImage(Thumb).Scale := jsEighth; // look delphi help - below
TJPEGImage(Thumb).Performance := jpBestSpeed;
Result:=true;
end;
BMP := bmpScaling(Thumb, w, h);
// w:=120, h:=120; 90-150 milliseconds
But in the 2 cases, do you have a thumbnail of 120x120 after loading?

Posted: Thu Nov 04, 2004 3:07 pm
by Guest
xnview wrote:But in the 2 cases, do you have a thumbnail of 120x120 after loading?
Yes, but look:

Code: Select all

gflLoadThumbnail(PChar(filename), w, h, gfl_bmp, lp, finfo);
// Here is of course 120x120.
In my procedure:

Code: Select all

Thumb.LoadFromFile(FileName); 
TJPEGImage(jpg).Scale := jsFullSize;
// Now is 1/8 original size (e.g for original size 2048x1536 thumb. is 256x192)
// (....)
BMP := bmpScaling(Thumb, w, h);
// After scalling is 120x120. All time (reading + scalling is 90-150 msec)

Posted: Thu Nov 04, 2004 3:10 pm
by Guest
Sorry, i have bugs in previous post, below is correct:
Yes, but look:

Code: Select all

gflLoadThumbnail(PChar(filename), w, h, gfl_bmp, lp, finfo); 
// Here is of course 120x120. 
In my procedure:

Code: Select all

Thumb.LoadFromFile(FileName); 
TJPEGImage(Thumb).Scale := jsEight; 
// Now is 1/8 original size (e.g for original size 2048x1536 thumb. is 256x192) 
// (....) 
BMP := bmpScaling(Thumb, w, h); 
// After scalling is 120x120. All time (reading + scalling is 90-150 msec)