ExifTool Forum

ExifTool => Developers => Topic started by: BarryIptcStan on July 03, 2025, 02:42:01 PM

Title: Exif and a duplicate tag ID (InteroperabilityIndex + GPSLatitudeRef are ID: 1)
Post by: BarryIptcStan on July 03, 2025, 02:42:01 PM
Hey there! I made an enumeration over all defined Exif tags in the Exif 3.0 standard. (available for download through CIPA here (https://www.cipa.jp/std/documents/download_e.html?DC-008-Translation-2023-E))

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 (https://github.com/SixLabors/ImageSharp/pull/2938), 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
Title: Re: Exif and a duplicate tag ID (InteroperabilityIndex + GPSLatitudeRef are ID: 1)
Post by: Phil Harvey on July 03, 2025, 02:46:36 PM
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
Title: Re: Exif and a duplicate tag ID (InteroperabilityIndex + GPSLatitudeRef are ID: 1)
Post by: BarryIptcStan on July 03, 2025, 04:00:13 PM
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 (https://exiftool.org/TagNames/EXIF.html) 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" (https://exiftool.org/TagNames/GPS.html). 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:


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" (https://www.itu.int/itudoc/itu-t/com16/tiff-fx/docs/tiff6.pdf#:~:text=A%20Baseline%20TIFF%20reader%20is,beyond%20the%20first%20one) 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! :)