2004.07.26 10:07 "[Tiff] Is this possible by using LibTiff?", by Sachin Garg

2004.07.29 20:55 "Re: [Tiff] Is this possible by using LibTiff?", by Sachin Garg

It is still don't clear for me why do you need to store the directory.

So that I can later recreate a tiff with exactly same characteristics as original. Not everything is done in a single program run, so I need to store all tag values.... and I cant think of an easier way rather than just storing the tiff directory using libtiff.

(I do agree to the point mentioned earlier that I should in this case not write -or-later-destroy- the TIFF file header to avoid confusion)

You can read the tags from input image one by one and write them out afterwards. There is one pitfall here: libtiff can "understand" the subset of the "well known" TIFF tags only (i.e., the ones defined in the TIFF specs and several other widely used tags). The library can't interpret arbitrary proprietary tags, but you can read them anyway using custom tags technique. Consult with the tiffinfo (actually tif_print.c module) and tiffdump sources to find the approaches to read custom TIFF tags.

Yep... I did came across this limitation and have checked the source files you have referred to... I had coded small routines to access/copy the cutom tags, quite similar to what is done in tif_print.c

Anyway... now I will switch to the routines used in tif_print.c, thanks.

If you still want to write the directory contents somwhere you should use TIFFCheckpointDirectory() function after filling the tag values. It flashes directory out, but you should be very carefull with the strip offsets and sizes. It wil be better to use the single strip in this case.

I dont understand what you mean by writting a single strip. I dont want to write _any_ image data (when storing only the directory)

Do you mean that if I attempt to write a directory without writing any image data (just to save tags for future use) libtiff will automatically reset the size related fields accordingly?

It doesnt seems that way from the code, but that sure will be bad news for me...

Sachin Garg