Strange contour when compositing PNGs with alpha in image editor


I have an issue maybe you guys can help.

alpha line

This image is composed of several render layers.
On the left, all layers are combined in Blender’s compositor.
On the right, the same is done in Affinity Photo. (same result in any image editor)

If you look closely, there’s a dark contour line in the right image where the objects meet the pinkish background.
Why is this happening?
Is something wrong with how Blender exports alpha layers?

Layers were exported in RGBA PNG.

Thank you for your help!

I think it’s a result of “double masking”. Blender premultiplies the alpha channel, which means that the edges of your alpha channel will have a certain amount of the background built in and that extra data is being mixed in when Affinity tries to blend. You can probably fix that by exporting a straight alpha channel (alpha convert node) as a separate image, and then assigning that as the mask channel for that layer in Affinity. If you use this workflow, you should export your source image as an RGB PNG and drop the A channel to keep the edge pixels safe and allow the new mask image to handle the edge.


hmmm… interesting.
That’s a kinda big workaround when dealing with a lot of images but it may work. I’ve already tried to convert to straight and it helps a bit but not totally.

I will try your suggestion tomorrow and will post back.
Thank you @BK_Lightning!

After a lot of trial and error, and although this still outputs a very slight contour, the only thing that works and it’s easy to implement is to put a Convert Alpha set to Straight as the last node.

Here’s the result at 200% zoom:

Not perfect but good enough! :partying_face::tada:

1 Like

Glad you fixed it!

“Premultiplication” is done to avoid “jaggies” when a PNG image is displayed – especially on cheap hardware. The computation is done in advance so the hardware doesn’t have to.

Categorically, I recommend compositing using the MultiLayer OpenEXR file format, instead. Throughout your entire pipeline.

This format – originally conceived by Industrial Light & Magic with a little help from Blender Foundation – is very specifically a data file format. It precisely captures the “many layers of numbers that is the true output of the rendering process – without loss. (Yeah, the files are “big,” and “one file per frame,” but who cares?)

When you have produced your final comp in this format, then you write additional blend-files to produce your intended deliverable(s), whatever those may be, each one drawing from the pristine OpenEXR master. Only then is the image compressed and encoded to suit the needs of that image file format and the intended display hardware. During the pipeline, the data is never compromised.