Canon CR2 large thumbnail

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

Moderators: XnTriq, xnview

KingLeonid
Posts: 6
Joined: Wed Sep 03, 2008 2:06 pm
Contact:

Canon CR2 large thumbnail

Postby KingLeonid » Wed Sep 03, 2008 2:17 pm

Hi,

I'm trying to use GFL for loading Canon CR2 files. I need to load thumbnail first, then after user clicks on it, load full image.
I faced the following problem with thumbnails for CR2:
If I load embedded thumbnail then it loads very fast but thumbnail is very small. I need larger thumbnail images (256x256 for example) and I know that inside CR2 format there is not only thumbnail + raw sensor full size image, but there is also a large JPEG image - some kind of large preview.
For exmaple in CR2 file with 10Mpix image, there is also 3Mpix jpeg image inside.

Could GFL load that portion of CR2 (IFD #1 Segment) into memory using fast JPEG decoding algorithm?

P.S: I know that some viewers use this segment for displaying CR2 instead of loading raw sensor data.
Best regards, Leo.

KingLeonid
Posts: 6
Joined: Wed Sep 03, 2008 2:06 pm
Contact:

Postby KingLeonid » Fri Sep 05, 2008 9:20 am

May be I choose incorrect forum for my question?
Pierre, could you, please, give me an answer to my question.
Best regards, Leo.

User avatar
xnview
Author of XnView
Posts: 28291
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Postby xnview » Fri Sep 05, 2008 1:15 pm

Could try with gflLoadThumbnail & 0 as w/h size
Pierre.

KingLeonid
Posts: 6
Joined: Wed Sep 03, 2008 2:06 pm
Contact:

Postby KingLeonid » Fri Sep 05, 2008 1:45 pm

Thank you for reply.
Now I've got it with LOAD_PARAMS.Flags=0, w=, h=0.
If I set Flags = EMBEDDED_THUMBNAIL then I got small picture, that's also good.

But anyway the loading process of the large preview image is very slow. :(

I've just compared two tests:
1. Loading larger preview 1953x1301 from CR2 file via LoadThumbnail
2. Loading the same image 1953x1301 from previously saved JPEG file via LoadBitmap

And I could say that loading image from JPEG at least three times faster.
But why?

P.S: According to CR2 spec that I found in the INET, larger preview is also compressed by JPEG algorithm.
PPS: My original size of CR2 is 3906 x 2602.
Best regards, Leo.

User avatar
xnview
Author of XnView
Posts: 28291
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Postby xnview » Fri Sep 05, 2008 1:58 pm

Please send me a CR2?
Pierre.

KingLeonid
Posts: 6
Joined: Wed Sep 03, 2008 2:06 pm
Contact:

Postby KingLeonid » Fri Sep 05, 2008 2:17 pm

I've uploaded zip archive with 2 images - CR2 + JPEG from my test example.
ZIP is 8.6 Mb of size.
Here is the link: http://xnc.jinr.ru/personal/download/canon.zip

Thank you for cooperation.
Best regards, Leo.

User avatar
xnview
Author of XnView
Posts: 28291
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Postby xnview » Mon Sep 08, 2008 7:26 am

With your file, i get a embedded thumbnail of 1936x1288, it's quick
Do you use GFL_LOAD_EMBEDDED_THUMBNAIL?
Pierre.

KingLeonid
Posts: 6
Joined: Wed Sep 03, 2008 2:06 pm
Contact:

Postby KingLeonid » Mon Sep 08, 2008 7:58 am

Dear Pierre,
If I use GFL_LOAD_EMBEDDED_THUMBNAIL then I only got very small image 160x120.
Here is the code:

Code: Select all

gflGetDefaultThumbnailParams(&param);
param.Flags |= GFL_LOAD_EMBEDDED_THUMBNAIL;
errcode = gflLoadThumbnail(fname, 0, 0, &ibitmap, &param, 0);


If I do not modify default thumbnail params, then I get large preview but loading is slow.
Best regards, Leo.

User avatar
xnview
Author of XnView
Posts: 28291
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Postby xnview » Mon Sep 08, 2008 8:04 am

So send me your email by PM, i'll send new SDK
Pierre.

KingLeonid
Posts: 6
Joined: Wed Sep 03, 2008 2:06 pm
Contact:

Postby KingLeonid » Mon Sep 08, 2008 11:58 am

Dear, Pierre

Thank you for your new version of SDK.
Libgfl290 now works well, and loads large preview very fast.

I really appreciate your early replies and your help in fixing this problem.
Best regards, Leo.

barry
Posts: 3
Joined: Tue Jan 08, 2013 7:17 pm

Re: Canon CR2 large thumbnail

Postby barry » Fri Jan 18, 2013 5:54 pm

Dear Pierre!

I have the same problem with loading embedded Thumbnails from RAW-files for Canon PowerShot cameras (with CHDK).

Code: Select all

    lp.Flags := GFL_LOAD_EMBEDDED_THUMBNAIL;
    fGflErrCode := gflLoadThumbnailW(PWideChar( filename ), 0, 0, @gfl_bmp, @lp, finfo);

This code loading a very large thumbnail (1836x1380 px).
You need original RAW-files (.CRW, .DNG)?

barry
Posts: 3
Joined: Tue Jan 08, 2013 7:17 pm

Re: Canon CR2 large thumbnail

Postby barry » Fri Jan 18, 2013 6:17 pm

XnView also build Thumbnail for directory with this RAW-files large time (generate from source image).

User avatar
xnview
Author of XnView
Posts: 28291
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Canon CR2 large thumbnail

Postby xnview » Mon Jan 21, 2013 10:37 am

yes in RAW you can have big image
Pierre.

barry
Posts: 3
Joined: Tue Jan 08, 2013 7:17 pm

Re: Canon CR2 large thumbnail

Postby barry » Tue Jan 29, 2013 9:13 am

xnview wrote:yes in RAW you can have big image

The original big image I load without problems through gflLoadBitmap. But I mean, if I load the embedded Thumbnail - it is also converted from a large original image, but not extracted from EXIF.


Return to “GFL SDK”

Who is online

Users browsing this forum: No registered users and 0 guests