AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2007.01.31 10:53 "[Tiff] Interpreting SubIFDs tag", by mikk
2007.01.31 17:23 "Re: [Tiff] Interpreting SubIFDs tag", by Joris
2007.02.01 09:42 "Re: [Tiff] Interpreting SubIFDs tag", by Gerben Vos
2007.02.01 18:32 "Re: [Tiff] Interpreting SubIFDs tag", by Joris
2007.01.31 19:24 "Re: [Tiff] Interpreting SubIFDs tag", by Phil Harvey
2007.01.31 19:54 "Re: [Tiff] Interpreting SubIFDs tag", by Joris
2007.01.31 22:24 "RE: [Tiff] Interpreting SubIFDs tag", by Grissom, Ed
2007.02.01 18:17 "RE: [Tiff] Interpreting SubIFDs tag", by Phil Harvey
2007.02.01 18:34 "Re: [Tiff] Interpreting SubIFDs tag", by Joris
2007.02.01 18:48 "Re: [Tiff] Interpreting SubIFDs tag", by Phil Harvey
2007.02.01 19:00 "Re: [Tiff] Interpreting SubIFDs tag", by Joris
2007.02.01 19:36 "Re: [Tiff] Interpreting SubIFDs tag", by Phil Harvey
2007.02.01 20:02 "Re: [Tiff] Interpreting SubIFDs tag", by Joris
2007.02.01 15:46 "Re: [Tiff] Interpreting SubIFDs tag", by Phil Harvey

2007.01.31 17:23 "Re: [Tiff] Interpreting SubIFDs tag", by Joris

mikk,

I'm a bit confused with interpreting SubIFDs tag value.

Each value of N values in SubIFDs tag is an offset (from the beginning of the TIFF file, as always) to a child IFD. But is each value of N values an offset to a single child IFD, or to the first IFD from a linked list of IFDs? When I read each of these N child IFDs, am I supposed to interpret NextIFDOffset field and read next directory from this position for each of child IFDs?

Both are possible, and both are common. In fact, sometimes both are combined, and I've come accross files where the same second and third SubIFD gets pointed to in both ways.

What I do, is take the value of the SubIFDs tag as an array, and build a list of pending IFDs to read from that. For each IFD I read, I take its next IFD offset pointer and if it's not zero marking the end of the list, I add it to the front of that list of pending IFDs to read. Before adding any initial or secondary value to the list, I double-check and see that I've not read that IFD before.

The first part of this scheme makes sure I get at all SubIFDs, whether they are mentioned inside the tag value or inside a linked list, or both. The last action prevents double inclusion and IFD looping.

Best regards,

Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be/
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html