Bug: Canon EOS-1D X Mark III CR3 thumbnail problem

Started by Damon Lynch, February 20, 2020, 07:12:15 PM

Previous topic - Next topic

Damon Lynch

Hi Phil,

Linux, ExifTool 11.88, using CR3 file from Canon EOS-1D X Mark III CR3:

exiftool -b -ThumbnailImage 93FG5559.CR3> ~/image.jpg

The resulting thumbnail is not an image that any program I have tried recognizes, which I assume means something is going wrong.

Tag output seems normal:


Preview names:  ['PreviewImage']
Preview size:  27584


(However, I note that that is one less preview than an EOS R CR3.)

Incidentally, ExifTool does not detect any thumbnail / preview image in a Canon EOS-1D X Mark III HIF (HEIF) file. I really have no idea if the HEIF file actually has one or not!

If you need some sample files (CR3 and/or HIF) to work with, please email me at email address found here: https://damonlynch.net/
I do not own the camera, but got some sample images from a photographer who does.

Thanks,
Damon

Phil Harvey

Hi Damon,

I get this with a sample I have here with the current version of ExifTool:

> exiftool ../pics/CanonEOS-1D_XMarkIII.cr3 -preview:all
Thumbnail Image                 : (Binary data 17080 bytes, use -b option to extract)
Jpg From Raw                    : (Binary data 2477162 bytes, use -b option to extract)
Preview Image                   : (Binary data 471632 bytes, use -b option to extract)


And all 3 of these previews are good JPG images.

I don't have any HEIF samples from this camera.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Damon Lynch

Ahh yes, long day yesterday and it seems I forgot all about that -preview command. Running it now I see:

exiftool 93FG5559.CR3 -preview:all
Thumbnail Image                 : (Binary data 27584 bytes, use -b option to extract)
Preview Image                   : (Binary data 418640 bytes, use -b option to extract)


Possibly the difference in the number of preview images from your sample arises from my sample being generated while the camera was in HDR mode (it was producing HEIF files alongside it). I can't figure out the type of data in the Preview image. It doesn't seem to be a file type the Linux program file (version 5.37) recognizes.

Damon Lynch

Some output on the corresponding HEIF file, indicating a problem identifying the two preview images:

$ exiftool 93FG5559.HIF -preview:all
Warning: [minor] Overlapping MakerNotes values - 93FG5559.HIF


Output from heif-info 1.6.2:

$ heif-info 93FG5559.HIF
MIME type: image/heic
image: 5472x3648 (id=1), primary
  thumbnail: 320x214
  thumbnail: 1620x1080
  color profile: nclx
  alpha channel: no
  depth channel: no

Phil Harvey

Hi Damon,

Thanks for the samples.

Interesting.  The embedded preview in these CR3 files are not JPG format.  They are instead basically HEIF format without the file header.  I don't know how to display these.  I guess this is what happens if you set the camera to use HEIF format.

And you are right, I don't see any previews in the HEIF files.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Damon Lynch

Hi Phil,

Quote from: Phil Harvey on February 21, 2020, 11:27:39 AM
Interesting.  The embedded preview in these CR3 files are not JPG format.  They are instead basically HEIF format without the file header.  I don't know how to display these.  I guess this is what happens if you set the camera to use HEIF format.

If anyone is interested, I have opened this issue with libheif to see if it makes sense for it to be able to render these previews as they are, or if a file header must be somehow programmatically attached first: https://github.com/strukturag/libheif/issues/206

Quote from: Phil Harvey on February 21, 2020, 11:27:39 AM
And you are right, I don't see any previews in the HEIF files.

Given heif-info is reporting two previews, does that mean you think that its output is wrong, or alternatively that ExifTool currently does not see them and needs to be fixed to make it see them? Sorry that I'm missing the meaning here.

Damon

Phil Harvey

#6
Hi Damon,

Quote from: Damon Lynch on February 21, 2020, 09:34:18 PM
Given heif-info is reporting two previews,

You are right.  I should have looked more closely.  I can see the data for these previews, but they are HEVC format, and ExifTool doesn't (yet) extract them.

- Phil

Edit: In fact, you can see these images with ExifTool:

> exiftool -ImageSpatialExtent -a -G3 ../pics/CanonEOS-1D_XMarkIII.hif
[Doc1]          Image Spatial Extent            : 2752x1856
[Main]          Image Spatial Extent            : 5472x3648
[Doc2]          Image Spatial Extent            : 320x214
[Doc3]          Image Spatial Extent            : 1620x1080


(I think the Doc1 2752x1856 image(s) are the sections of the grid that make up the full image.)
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

Looking more closely at this and analyzing the preview data itself, I see the following structure in thumbnail image from the CR3 you provided:

Tag 'CISZ', count 20
Tag 'hvcC', count 175
Tag 'colr', count 19
Tag 'pixi', count 16
Tag 'IMGD', count 27340
Tag 'free', count 14

However, the thumbnail in the HIF file has no discernible structure, and length 27324 bytes.  I think it probably corresponds to the 'IMGD' (presumably "IMaGe Data") box in the CR3 thumbnail.

Historically, ExifTool extracts only previews that constitute stand-alone files (otherwise they wouldn't be very useful).  So it would be necessary to add some sort of supporting file structure to extract previews like this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Iliah Borg

Hi Damon,

Could you please share a few Canon HEIF samples and a sample or two of CR3 w/ HEIF preview with LibRaw? We maintain a free open source library for decoding raw files. Our e-mail is info@libraw.org