2011.09.16 22:53 "[Tiff] Write Exif data to Tiff file", by DonM

2011.09.27 09:36 "Re: [Tiff] Write Exif data to Tiff file", by Joris Van Damme

What is needed is a way to take a user-provided private IFD blob (perhaps in JPEG-style format with tag offsets from the start of the blob) and add it to the TIFF as a private IFD, while fixing up all tag offsets to so they are offsets from the start of the file (JPEG and TIFF EXIF offsets are different).

That would be plain wrong. TIFF is a linked list of IFDs, in its bare essence. An IFD is an array of tags, in its bare essence. A tag has a an ID, but the tag mechanism is independent of the actual value of the ID (meaning, reading or writing a tag, is a mechanism that can safely ignore whether the tag is ImageWidth or an Exif date or whatever). A tag also includes a count, and a datatype, but again this is independent of the actual value of the tag ID (meaning, it is perfectly legit to use some tag with datatype x in one instance, and datatype y in another instance, for example). One particular datatype is IFD offset, and that's how the IFD list eventually turns into an IFD tree.

This is the bare essence of TIFF. It would stand to reason that any TIFF library would provide a generic interface to both read and write at this level, first, and next build on from that.

Unfortunately, the LibTiff library was simply not designed that way. A whole series of hacks have been created to target a whole series of functional shortcomings this results in. The hacks include registration of private tags, special handling of EXIF IFDs, etc... It's usefull to note that the combined effort of creating these hacks, outweighs creating the logical generic interface.

At this point, there's three options...

  1. either someone goes in and adds that bottom layer of generic IFD/tag handling, once and for all, and next just gets rid of the hack series and/or rewrites them to use the generic interface and next depreciates them and documents the generic alternative.
  2. or someone goes in and adds yet another hack, for writing EXIF IFDs, fully aware that this will certainly not be the last hacks that is required and fully aware that reading/writing private IFDs, for example, is still not supported that way.
  3. or nobody goes in at all, and LibTiff remains unable to deal with TIFF's basic units.
  4. So far, it's been option 3. As Bob points out, that's not likely to change.

Best regards,

Joris Van Damme
AWare Systems
info@awaresystems.be
http://www.awaresystems.be/