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.
From: firstname.lastname@example.org [email@example.com] On Behalf Of Amir Ebrahimi [firstname.lastname@example.org]
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:
a = pp;
r = (a*pp + 127) / 255;
g = (a*pp + 127) / 255;
b = (a*pp + 127) / 255;
The alpha is still written out, however, why is the alpha being pre- multiplied here?