AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2012.05.18 13:23 "[Tiff] TIFFGetField: count should be uint32_t (Bug in documentation)", by Sandro Mani
2012.05.18 14:27 "Re: [Tiff] TIFFGetField: count should be uint32_t (Bug in documentation)", by Bob Friesenhahn
2012.06.27 15:12 "[Tiff] variable sized tags and passcount", by David Hoese

2012.06.27 15:12 "[Tiff] variable sized tags and passcount", by David Hoese

I'm trying to understand the TIFFFieldInfo struct since I will be creating my own tags to fit another system and I'm getting confused by a few things.

Excluding ASCII values, if you have a read/write count of -1, doesn't that mean that passcount needs to be provided to TIFFSetField and TIFFGetField? I thought this was true until I saw "StripOffsets" or "GrayResponseUnit" which use a -1 read/write count and have passcount set to 0. How does libtiff know how many elements are passed if there is no count passed? I understand that for ASCII values it can read until it gets the NUL character, but what about numeric values? Also, why does "StripOffsets" (and others) use -1 for a read/write count if this page says that it's always 1:

http://www.remotesensing.org/libtiff/man/TIFFGetField.3tiff.html

I've done a few tests using pylibtiff and adding on the functionality to create my own tags that have worked. I read in the FAQ that the number of elements in a tag is stored in the tiff file, is it possible to read that size out? I ask this mainly because in my tests if I make a multi-element tag (with passcount=0) and read it I get an array pointer returned but I have to know the size of the element to do anything useful with it. Is there another way to do this or should I make passcount=1? Does changing the passcount affect how other programs read the tag? Does passcount change what is written to the file?

Any help understanding this would be greatly appreciated. Thanks.

-Dave

P.S. I was pretty confused from the start based on this page http://www.remotesensing.org/libtiff/addingtags.html because the example xtiffFieldInfo array has every tag being variable sized. I thought this was required for all custom tags, but I've found that its not.