2004.09.16 14:55 "Re: [Tiff] reading private subdirs", by Frank Warmerdam
is it possible to read, enumerate and extract all tags from a private sub-dir using v3.6.1? if so, how? the goal is an EXIF tag reader.
in 3.5.7, i could use tiff_pdsdirread.c, but that code does no work with 3.6.1 (due to changes in tag reading in 3.6.1).
(yes, this is a rephrase of my question from last week...)
With 3.6.1 it should be possible to extract all tags from a private IFD, but (I think) you would still need to know what tags you want to try and query for. That is, I don't think there is a public way of enumerating all tags in an IFD.
I would add that there are still two classes of tags in libtiff.
"Builtin" tags generally have special places they are dumped in the TIFF directory structure and often have various special logic around their handling.
"Custom" tags (really generic tags) are stored in a generic data structure and any previouslyi unknown tags encountered are treated this way as well as pre-defined tags without their own custom field in the TIFF directory. Currently I think the only predefine tag handled this way is TIFFTAG_SOFTWARE, done this way to ensure that the custom code is working more than anything.
It would be easy to add a function to enumerate all custom tags read from a particular directory, but it is a bit messier to determine which builtin tags were read. Also, there is some "pseudotag" handling and automatic defaulting of tags that might interfere.
Another thing I have not tried personally is reading an IFD without any of the core image definition tags as would be the case with EXIF IFDs as I read the spec. I suspect that TIFFReadDirectory() will flip out issuing errors about this.
In short, I think some non-trivial work would be required to make the normal TIFF directory reading code work smoothly with non-image IFDs such as those used for EXIF.
I see a couple approaches to this:
- Introduce a version of the tiff_pdsdirread.c code into the core of libtiff specifically for reading non-image IFDs.
- Try and make the normal directory reading somehow work with non-image IFDs.
I am inclined to think that (1) would be easier to incorporate without potentially causing alot of extra problems. However, I am unlikely to do the implementation myself so we will have to hear from Bob and Andrey. As Bob mentioned, he is hoping to develop and incorporate EXIF support into the libtiff core so it might be best to work with him to resolve this issue.
I set the clouds in motion - turn up | Frank Warmerdam, firstname.lastname@example.org
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent