2002.09.06 17:02 "TIFF Tags modifcation", by KKP

2002.09.06 17:45 "RE: TIFF Tags modifcation", by Duane H. Hesser ZZ

Hi All I am new to TIFF programming and this library. Can anybody please help me on this issue

I will need to manipulate and add some TIFF tags to an existing TIFF. Will it be sufficient to simply move the existing data to accommodate the new entries and potentially changes in the length of values (I realize I have to update (and potentially move) the directory entries with the new offsets, as well)?

Also, according to the documentation I have seen, the Value will be placed in the directory entry if it fits in the four bytes otherwise used by the Offset. Am I correct in assuming that the determination will be based on the value type (i.e. BYTE, SHORT, LONG will be stored in the directory entry, while (ASCII) strings and RATIONAL values are pointed to by the Offset? Did I miss any of the value types?

In the libtiff distribution, there is code in "./contrib/tags" which provides a framework for adding private tags to libtiff using "client" hooks in the main library. There is even "template" code which can be modified to add your tags. This approach insulates your code from future modifications to the main library. The standard libtiff machinery will then be used to properly place values/offsets. (There are 12 value types, BTW, see TIFFDataType in tiff.h.)

You will then need application-level code (e.g. a modified 'tiffcp' to read, modify, and write the modified file.

--------------
Duane H. Hesser
dhh@androcles.com