AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

1999.11.15 13:59 "multiple tiff files", by Peter Zitzelsperger
1999.11.18 09:07 "Re: multiple tiff files", by Ledoux
1999.11.19 10:16 "Re: multiple tiff files", by Peter Zitzelsperger

1999.11.19 10:16 "Re: multiple tiff files", by Peter Zitzelsperger

Hi!

First of all, thanks to your comment.

If your purpose is to save multiple images in the same tiff file, the exact term is multipage tiff, I can assure that the libtiff supports it without any problem, provided that you ONLY use the libtif functions to read or write tiles.

Yes, I want to create a multipage tiff, and I use *ONLY* libtiff functions.

// open tiff file with TIFFOpen(...)

Do you open file in mapped "w" mode or unmapped "wu" mode? Just a question normally it shouldn't affect the file.

Open parameter is ''w''

// 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 );

What is your WriteBuffer2Tiles method doing? does it call TIFFWriteTiles or any other IO function to write to the file?

WriteBuffer2Tiles does nothing but calculate tiles from strips and writing the tiles with TIFFWriteTile() from the libtiff. I had long debug sessions to find that a _TIFFmalloc() in TIFFwritebufferSetup() does not what it is supposed to. Funny enough, the application does everything correctly when I step through with the debugger, but it returns an error and exits, when I run it in one step. So, in theory, its impossible, to find the mistake. Well, I don't know how, but I'll continue to search...

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,...)

Don't hesitate to contact me if you have any other problem.

Well, here I am. Thanks in advance...

Peter Zitzelsperger.