New feature 'Scale' for jpeg reading

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

Guest

New feature 'Scale' for jpeg reading

Post 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.
User avatar
xnview
Author of XnView
Posts: 44355
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: New feature 'Scale' for jpeg reading

Post 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.
Pierre.
Guest

Post 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 :(
User avatar
xnview
Author of XnView
Posts: 44355
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Post 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?
Pierre.
Guest

Post 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.
------------------------
User avatar
xnview
Author of XnView
Posts: 44355
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Post 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?
Pierre.
Guest

Post 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)
Guest

Post 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)