Exif and a duplicate tag ID (InteroperabilityIndex + GPSLatitudeRef are ID: 1)

Started by BarryIptcStan, July 03, 2025, 02:42:01 PM

Previous topic - Next topic

BarryIptcStan

Hey there! I made an enumeration over all defined Exif tags in the Exif 3.0 standard. (available for download through CIPA here)

However, it seems that `GPSLatitudeRef` and `InteroperabilityIndex` share the same tag ID: `1`.

Rust takes notice:

barrett@farts ~/D/p/r/raves_metadata (feat/exif) [101]> cargo check
    Checking log v0.4.27
    Checking raves_metadata_types v0.1.0 (/home/barrett/Documents/projects/raves-project/raves_metadata/raves_metadata_types)
error[E0081]: discriminant value `1` assigned more than once
   --> raves_metadata_types/src/exif/parse_table.rs:17:9
    |
17  |           pub enum KnownField {
    |           ^^^^^^^^^^^^^^^^^^^
...
101 | / create_known_fields_enum! {
102 | |     /*
103 | |      *
104 | |      *
...   |
794 | |     GPSLatitudeRef = 1 => {
    | |                      - `1` assigned here
...   |
971 | |     InteroperabilityIndex = 1 => {
    | |                             - `1` assigned here
...   |
975 | |    },
976 | | }
    | |_- in this macro invocation
    |
    = note: this error originates in the macro `create_known_fields_enum` (in Nightly builds, run with -Z macro-backtrace for more info)

In your view, should I omit the newer `InteroperabilityIndex` tag? Or, should I add special handling for ID = 1 (determining which one to yield based on count, either 1 or 2)?

One .NET library said they don't use it, but I'm not sure if that excuse is quite sufficient for a metadata parsing library...

I'd appreciate any advice you could give! ;D
my suffering is progressing

Phil Harvey

Tag ID 1 in the InteropIFD is InteroperabilityIndex, but in the GPSIFD it is GPSLatitudeRef.

But you missed InteropVersion and GPSLatitude which both have tag ID 2.

The InteropIFD tags carry important color space information.

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

BarryIptcStan

Thank you for the advice!

However, I can't find an `InteropVersion` in the specification. Is that a widely used, vendored private tag, or was it forgotten in v3.0?

ExifTool defines it in its "HTML" table as being excluded from the Exif v3.0 spec. In that case, how do you differentiate between it and `GPSLatitude`? For ExifTool, it's defined in another table, "GPS". To my knowledge, these "groups" are only seperated for better organization within the standard. However, there being duplicate tags suggests that each group is actually an individual IFD..!

The problem I'm then facing might be better formatted as a question:

  • If an IFD is intended to describe only a subset of tags alongside which it is defined,
  • and IFDs do not specify an identifier to say which subset it represents,
  • how do you tell which IFD contains which set of tags?

In other words, if IFDs are, in practice, separated by group, how can you tell which IFD is which when parsing a file? I can imagine some heuristics used for this, but that sounds kinda 'leaky' for private tags. That would also mean that TIFFs would need to use "subfiles" to provide certain tags.

If they aren't usually separated by group, then how can you tell the duplicate pairs apart during parsing?

I very much appreciate your expertise - thank you so much for replying! :)
my suffering is progressing