AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2008.11.18 02:14 "[Tiff] Creating a tiled tiff from scratch (essentially)", by Beck, Tucker A
2008.11.18 04:04 "Re: [Tiff] Creating a tiled tiff from scratch (essentially)", by Frank Warmerdam
2008.11.18 09:28 "Re: [Tiff] Creating a tiled tiff from scratch (essentially)", by

2008.11.18 04:04 "Re: [Tiff] Creating a tiled tiff from scratch (essentially)", by Frank Warmerdam

I am using libtiff in an image processing application. The input images are tiled, multi-image, JPEG compressed tiff files. I have had great success in opening, converting, and processing the image data using libtiff. Now, I need to be able to store the results of processing in a new tiff file. I have encountered a few problems along the way.

When I create the tiff file, I would like to set up each directory when I create the file. I do not want to store any image data in them at creation, I just want them to be ready for writing data when it needs to be done. There are somewhere between 3 and 7 directories that I need to make. It seems like the only way to do this is to set all the fields for the directory, write a single dummy tile (using TIFFWriteTile) and then write the directory (TIFFWriteDirectory). This seems like an ugly way to do things; I'd rather not have to write any data until absolutely necessary. If I try to write the directory without having written a tile, I get a message that says, "MissingRequired: lib/op.svs: TIFF directory is missing required "TileOffsets" field." Is there any way to set up the directory with all the fields correctly assigned, but no data yet written?

Tucker,

Try calling TIFFWriteCheck() before calling TIFFWriteDirectory(). It sets the "been writing" flag which appears to be necessary.

like:

         TIFFWriteCheck( hTIFF, TIFFIsTiled(hTIFF), "GTiffDataset::Crystalize");

Note that you will produce a TIFF file with zeros for all the tile offsets. Many applications will choke badly on such a file. So be cautious about letting these files go into the wild in this state.

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