
Thread
2009.04.27 19:49 "[Tiff] Question regarding unassociated alpha", by Amir Ebrahimi
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?
:: Amir Ebrahimi::
Developer @ Unity Technologies
www.unity3d.com