Extract the 'right' IFD

Started by brolive, August 28, 2018, 03:55:34 AM

Previous topic - Next topic

brolive

Hello,

I develop and use a metadata editor that carry on ExifTool, and I have just discovered that some metadata could have the same name, but not the same value.
I extract all available metadata using options -a -s -t -G0, and I have the following result :
   ...
   EXIF   ImageHeight   4000
   EXIF   ImageHeight   338
   EXIF   ImageHeight   4056
   ...

In the example above I have 3 different values for ImageHeight.
I ask for a different extraction with options -a -s -t -G1 :
   IFD0   ImageHeight   4000
   IFD2   ImageHeight   338
   IFD3   ImageHeight   4056

After some search, I have understand that my image (a CR2) is made of multiple images located in differents IFD.
I would imagine that main image would be at IFD0, but it can be different according to image type (jpg, CR2, NEF, ...).

My question is now : How to recognize and extract the "main" image metadata ?

Thank you for your help

Olivier

Phil Harvey

Hi Olivier,

According to the EXIF specification, the main image is in the IFD with a SubFileType of "Full-resolution Image".  However, proprietary RAW formats such as CR2 don't necessarily follow this convention.  But if you add the -G4 option, the main image dimensions should be the one with no copy number (ie. the ones that are returned without -a).  So you could add -G1:4 to your command and look for the IFD with no "Copy#" group on the image dimensions.

- 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 ($).

brolive

Hi Phil,

Thank you for your answer.  :) I will try this !

Olivier