2004.07.26 12:23 "[Tiff] Saving multiple images to a tiff file...", by Sanjay Gupta

2004.07.26 13:30 "Re: [Tiff] Saving multiple images to a tiff file...", by Joris Van Damme

        TIFFSetField (tiff, TIFFTAG_SAMPLESPERPIXEL, 4); /* Hardcoded 32bbps*/
        TIFFSetField (tiff, TIFFTAG_BITSPERSAMPLE, 8);

Now when i try to reload the image from my program, the saved file is not recognized as a valid tiff file.

Just guessing here: are there truely 4 samples?

Either

  1. Your source data is 3 samples, R, G, and B, and there's a padding byte, which is common at least on windows systems nowadays. In this case, the padding byte should *not* be given to LibTiff. You'll need to tell it your data is 3 sampels wide, cause it really is, and convert from '32bit' RGB+padding byte to true 24bit RGB, in your clue code interfacing between the windows DIB (is it?) and LibTiff
  2. Or either you do intent to write 4 real samples, and the fourth sample most probably is alpha. In that case, you should indicate this by properly setting TIFFTAG_EXTRASAMPLES.

Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html