2004.01.20 23:17 "[Tiff] Alpha channel worries", by Stephan Assmus

2004.01.20 23:17 "[Tiff] Alpha channel worries", by Stephan Assmus

Hi all,

I have observed some weird effects when trying to save images with alpha channel and loading them later. The loading routine of the OpenBeOS TIFFTranslator just uses TIFFReadRGBAImage(). Images previously saved with that same translator, seem to have been modified to have the color channels associated with the alpha channel. This happens although I specify EXTRASAMPLE_UNASSALPHA for the alpha channel when saving. Is TIFFReadRGBAImage() specifically converting the RGB channels to be associated with the alpha channel (because libtiff assumes that's what the application wants)? Or might there be something wrong with me setting up the fields to specify EXTRASAMPLE_UNASSALPHA?

This is the code that sets up saving RGBA images:

        uint16 extraSamples[1];
 extraSamples[0] = EXTRASAMPLE_UNASSALPHA;
       TIFFSetField(tif, TIFFTAG_EXTRASAMPLES, 1, extraSamples);
       TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 4);

Best regards,
-Stephan