AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2009.04.27 19:49 "[Tiff] Question regarding unassociated alpha", by Amir Ebrahimi
2009.04.27 20:00 "Re: [Tiff] Question regarding unassociated alpha", by Chris Cox
2009.04.27 20:03 "Re: [Tiff] Question regarding unassociated alpha", by Amir Ebrahimi
2009.04.27 21:14 "Re: [Tiff] Question regarding unassociated alpha", by Daniel McCoy
[...]

2009.04.27 20:00 "Re: [Tiff] Question regarding unassociated alpha", by Chris Cox

Unassociated alpha should never be premultiplied - it is not associated with the color channels. Only assoicated alpha should be premultiplied.

Chris

________________________________________

From: tiff-bounces@lists.maptools.org [tiff-bounces@lists.maptools.org] On Behalf Of Amir Ebrahimi [amir@unity3d.com]

I'm using libtiff via FreeImage in our development tool: Unity.

We've had an image support regression with TIFF files after switching to FreeImage/libtiff from the QuickTime SDK. A file with unassociated alpha still seems to be getting pre-multiplied in with the RGB channels. Is this by design? I'd like to get the TIFF file with RGBA channels intact without it being pre-multiplied. If the image had associated alpha, then it would make sense that it was pre-multiplied, however, that isn't the case.

In libtiff (v3.9.0) line 268:269 has these comments:

case EXTRASAMPLE_ASSOCALPHA: /* data is pre-multiplied */

case EXTRASAMPLE_UNASSALPHA: /* data is not pre-multiplied */

which causes libtiff to use the following ContigPutFunc starting at line 1262:

putRGBUAcontig8bittile
{
        ...
        a = pp[3];

                r = (a*pp[0] + 127) / 255;
                g = (a*pp[1] + 127) / 255;
                b = (a*pp[2] + 127) / 255;

}

The alpha is still written out, however, why is the alpha being pre- multiplied here?