Composite:Exif\LensID becomes Composite:Nikon::LensID - why?

Started by Mac2, December 15, 2019, 08:26:04 AM

Previous topic - Next topic

Mac2

My software imports data from files via ExifTool and an intermediate XML file.

So far, the LensID tag for the Composite group used the et:id='Exif::LensID'.
My software relies on the et:id names for mapping and display purposes.

Today I received a NEF file produced by the NIKON D3200 camera. Here, the XML output lists the

LensID tag for the Composite group as et:id='Nikon::LensID'

This breaks the processing because my software manages lens data under Composite\Exif:LensID.

The original XML content produced by -G -X -t is:

<Composite:LensID et:id='Nikon::LensID' et:table='Composite'>Sigma 10-20mm F4-5.6 EX DC HSM</Composite:LensID>

It this an intended behavior or is something wrong with this file? Or did I understand something wrong?
I can provide the example image file on request for download.

Phil Harvey

If you check the Composite tags documentation, you will see that there are a number of different LensID tags, each with a unique id.

% exiftool -listx -composite:all | grep LensID
<tag id='Exif::LensID' name='LensID' type='?' writable='false' g2='Camera'/>
<tag id='Nikon::LensID' name='LensID' type='?' writable='false' g2='Camera'/>
<tag id='Ricoh::LensID' name='LensID' type='?' writable='false' g2='Camera'/>
<tag id='XMP::LensID' name='LensID' type='?' writable='false' g2='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 ($).

Mac2

This what confused me, sorry.
I see in the composite docs that there are multiple LensID tags, derived from different vendor-specific source tags.
But I don't see how the et-id used in the XMP is created from that.

I try to create a a super-tag for lens (best possible lens info) in my app, to simplify things for my users. All what they want is to display the information about the lens used.
Where this comes from is irrelevant and often confusing for normal people. Especially if the best lens info is not in one of the standard tags but in a vendor-specific tag and they need dig into metadata.

My software uses virtual tags like "lens", and bases these on Composite and other tags delivered by ExifTool.
Currently I use this sequence for lens (top to bottom, first tag with a value is used).

Composite\Exif::LensID\LensID
XMP::exifEX\LensModel\LensModel\0
Exif::Main\42036\LensModel
Exif::Main\42034\LensInfo
Composite\Nikon::LensSpec\LensSpec
Composite\Canon::Lens\Lens


This worked quite a while. And I'm frankly a bit fuzzy about the details why I set that up that way some years ago  ::)
Probably I thought that Exif::LensID will always be filled with the best data. And if it is empty, let my app look into other tags to find something.

From your reply I now understand that I should add the other vendor-specific Composite LensIDs into my enumeration, and put above Exif::LensID so they are checked first.

Composite\Nikon::LensID\LensID
Composite\Ricoh::LensID\LensID
Composite\XMP::LensID\LensID

Composite\Exif::LensID\LensID
...

Phil Harvey

Note that the Composite tag ID's were changed in ExifTool 11.55 (July 12, 2019) to include the module name.  Before that you would get inconsistent results if you were relying on Composite tag ID's because they would depend on the order in which the modules where loaded, which in turn depends on the order of processing the different types of 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 ($).

Mac2

Yes. This change actually broke some of by code and we've discussed this.
The new naming schema with Composite\Exif::LensID is more reliable and so this change was good (in the end, after I've debugged and updated everything in my code).