[Bf-committers] Problems with premultiplied alpha channel in 8 bit images

gespertino at gmail.com gespertino at gmail.com
Wed Feb 9 21:27:58 CET 2011


I use PNG files a lot for my work. I found that 8-bit RGBA files
(non-linear, with premultiplied alpha channel) saved from the
compositor have some sort of alpha contamination in the
semi-transparent pixels that makes them imposible to compose correctly
in other than Blender's compositor.

If the output has straight alpha (converted from premul with an alpha
convert node), there are no bright artifacts.
If the stored file is in linear space, there are no artifacts (both
with premul and straight alpha).

The artifacts become evident only in viewer* (checkers background) or
taking the premulled file into a different application (GIMP, Nuke) or
to Blender's VSE. Inside Blender's compositor there are no visible
artifacts.

Samples:
http://dl.dropbox.com/u/255376/alpha-bug/Alpha-Bug-Nuke.jpg
http://dl.dropbox.com/u/255376/alpha-bug/result%28VSE%20or%20GIMP%29.jpg

*) phonybone did some changes in the viewer and now the bright halo is
somewhat hidden. Now it's darker, but there's still alpha
contamination in the image pixels

Theory:
Linear>log and log>linear conversions are affecting alpha channel in
premultiplied alpha images. The bright artifacts are caused by the
division of the corrected R*A,G*A,B*A pixels by the un-corrected
alpha.

I tried to re-create this incorrect behaviour by gamma-correcting the
alpha channel artificially (I know it's wrong, I did it intentionally
trying to confirm the bug)

According to this graphic
(http://www.blender.org/typo3temp/pics/ea3a513824.jpg) all 8bit images
are converted to linear when used as inputs in compositor and
converted from linear to log in the output stage.
What happens with premultiplied alpha in that case? Is it divided
before linearizing and multiplied before gamma corrected or it is not?

I described the problem to phonybone in an IRC chat yesterday. He told
me that seb könig recently pointed out that displaying the alpha
channel (in image editor or compo backdrop) differs from color
decompose result. That might be the same problem.

Any ideas?


More information about the Bf-committers mailing list