2005.03.17 03:42 "[Tiff] libtiff and EXIF", by Ron
I've been looking at what is required to parse exif data using libtiff, and it looks like surprisingly little. It was trivial to bypass enough sanity checks to easily get it to recognise and read the ExifIFD and auto register all the tags it found there. And not that much harder to get it to recognise a similar tiff'ette extracted from the APP1 section of a jpeg file with exif data and then fed to libtiff.
So the biggest question is how you all feel about supporting this from libtiff. Obviously TIFFFieldInfo for exif tags, if people wanted them, could be cleanly separated from the main lib, so the main issue would be how to provide the necessary functions for generic IFD handling. (generic tags are already handled beautifully)
The easy way is to just provide some alternative functions, that (ab)use the existing structures as my proof of concept does, without the operations that are specific to valid .tif, but not found in exif data. The harder, but long term more rewarding way, would be to factor out a generic IFD interface, and reimplement the strictures of TIFF vX.Y on top of that. Harder because it probably means breaking the ABI (at least) to split common parts out of existing structures -- which is a pretty extreme step to add support for something not strictly tiff but might be justified in other ways all the same.
I'm not sure that there is much more to that which libtiff would need to provide for people to get basic access to exif data, either from in a tiff, or from data extracted out of a jpeg (by an external codec). Interpreting that data can be done in a layer above libtiff, but parsing the IFD's and tags out of the file is a job they both share and libtiff seems to have the best foundation I have seen to build that on. (or rather, to split it out of).