2005.03.10 10:46 "[Tiff] libtiff: Tiff Tag EXTRASAMPLES and TIFFRGBAImage", by Daniel Sievers

2005.03.11 09:17 "[Tiff] Re: libtiff: Tiff Tag EXTRASAMPLES and TIFFRGBAImage", by Daniel Sievers

To make it more obvious why this seems strange:

In the code below, it is checked for extrasamples>1, but then the only item considered is sampleinfo[0].

For the case extrasamples==1 (the common case), img->alpha is never changed from the original initialization to 0. (Therefore later the alpha channel from the file is ignored.)

   if (extrasamples > 1)
   {
        switch (sampleinfo[0]) {
        case EXTRASAMPLE_UNSPECIFIED:
                if (img->samplesperpixel > 3)
                        img->alpha = EXTRASAMPLE_ASSOCALPHA;
                break;
        case EXTRASAMPLE_ASSOCALPHA:    /* data is pre-multiplied */
        case EXTRASAMPLE_UNASSALPHA:    /* data is not pre-multiplied */
                img->alpha = sampleinfo[0];
                break;
        }
   }