
Thread
1999.11.15 13:59 "multiple tiff files", by Peter Zitzelsperger
Hi all!
I've been developing on some TIFF stuff on WIN NT with the libtiff*, I can create images, draw some stuff and save them properly. Now I find the need to create multiple TIFF images, and nothing works any more. So, what's the basic idea about multiple tiffs? My suggestion is:
// open tiff file with TIFFOpen(...)
// over all images
for( i4_image_count=0; i4_image_count<m_pt_image->GetNumImages(); i4_image_count++ )
{
TIFFSetDirectory( tiff_file, i4_image_count );
// set some basic tifftags like imagelength, imagewidth, samplesperpixel, bitspersample,...
// write the data in tiles
m_pt_image->WriteBuffer2Tiles( tiff_file,
m_pt_image->GetImageLength( i4_image_count ),
m_pt_image->GetImageWidth( i4_image_count ),
i4_image_count );
TIFFWriteDirectory( tiff_file );
}
This should guarantee, that every image entry has its own specific info and data.The trouble I run into is, that
- this loop works well for two images, after that, _TIFFalloc fails to get storage
- this loop works well for, say nine images, but the file created file has only two entrys, the second of which has strange values for the tags(samples per pixel,...)
I have no obvoius idea about where the code runs into trouble, perhaps you had a sinmilar problem?
*the libtiff version is 0.37 beta concerning the pathname, but version 0.24beta concerning the entry in the projectfile, that comes with the lib. Strange...? The lib itself compiles 'well' with DEV Studio 97 and Visual c++ 5.0 wih only 70 warnings.
Thanks for any ideas.
Peter.