2004.10.18 13:22 "[Tiff] How can I manually set the StripOffsets and StripCounts fields?", by Sachin Garg

2004.10.18 13:22 "[Tiff] How can I manually set the StripOffsets and StripCounts fields?", by Sachin Garg

#. What i am trying to do is...

I am reading a tiff file using libTiff and i want to write all the tags/directories in that image to a file (again using libTiff) without writing any image data.

( So that I can later read that tags file (using libtiff) to recreate a Tiff image with similar characteristics )

(I am using code from the tiffcp tool)

#. The problem I am facing is...

The TIFFReadDirectory function checks if the directory it is reading has a valid StripOffsets and StripByteCounts fields (or the corresponding tiles fields for tiled images)

While writting the tags file, i had not written any image data, so there are no such fields in the file and thus the ReadDir function fails.

#. A possible solution I can think of is to create dummy Offsets and ByteCounts fields (with values 0) in the tiff directory when I am writting only the tags. This way the ReadDir routine wont fail when I read in the file.

I couldnt figure-out how to create these dummy tags. I tried TIFFGrowStrips but I guess thatz not what I need to do. How can I create these dummy tags?

(And later when I will be writting the actual image data using other tiffcp's routines like writeBufferToContigStrips etc... I hope the dummy tags will get overwritten with correct values, or will I have to do something else for that?)

This query is related to an older post of mine which you can find at http://www.asmail.be/msg0055222442.html

Sachin Garg [India]
http://www.geocities.com/schngrg
http://sachingarg.go.to