2004.09.13 11:15 "[Tiff] help needed - adding Annotated text", by Sonaye Chandan

2004.09.13 14:15 "Re: [Tiff] help needed - adding Annotated text", by Frank Warmerdam

I need to add an annotated text to an TIFF image. The program will get the input like Path of the TIFF file, Text to be written, and where to write.

I can not use any ActiveX control as the code has to run on Solaris. How can I do this using libtiff?

Chandan,

This *should* be as simple as:

...
#include <tiffio.h>
...

   TIFF *tif;

   tif = TIFFOpen( filename, "r+" );

   TIFFSetField( tif, TIFFTAG_IMAGEDESCRIPTION, text_to_write );

   TIFFRewriteDirectory(tiff);
   TIFFClose( tif );

This is similar to what the tiffset utility program does. Note that each call to TIFFRewriteDirectory() will duplicate the directory resulting in the file growing by substantially more than the length of your image description text.

I would also note that this sort of dynamic update should only be used with relatively recent versions of libtiff. 3.6.0 or later should be fine.

Best regards,

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent