Jump to content

Layer Blending has odd interaction with the Alpha Channel


Recommended Posts

Hi,

I briefly looked around and didn't see anyone mention anything similar so hopefully this isn't a duplicate or me doing something stupid.

Yesterday I was trying to use layer blending, specifically the Multiply operation, to alter the color of an image containing sections which are completely transparent. I created a new layer over top, painted the whole thing a solid color, and then multiplied the 2 layers together. I would expect that any fully transparent areas would remain fully transparent after the multiply since an alpha value of 0 times any other alpha value should always be zero. Instead those fully transparent areas took on the solid color after the blend.

In RBGA terms, I expected:

1110 x 1111 = 1110

but I got

1110 x 1111 = 1111

And here is a more visual example. This would be accurate if shown on the checkerboard (completely empty background) but it'd be tough to see what's going on so that's why the background is black here.

example.jpg

Does Paint.NET not support alpha blending in all cases or am I inadvertently in the wrong color mode? I'm using version 3.510.4297.28964.

Thanks.

Link to comment
Share on other sites

From the online documentation:

Multiply: Each pixel component's intensity is multiplied with the pixel value in the composition. The result of using this blend mode is always pixels that are darker than the original. White pixels have no effect and are thus effectively transparent.

So with this blend mode - it is the white pixels that are transparent in terms of the blending operation.

Link to comment
Share on other sites

I get that; opaque white multiplied by any other color gives you that other color, and the white portions of that example image work the way I'd expect. I guess I'm just surprised that the alpha value of a color isn't taken into account during blending operations; it seems to be an RGB-only operation.

If I had access to Photoshop I'd check to see if they handle it the same way. Perhaps it's just an industry standard.

Link to comment
Share on other sites

The alpha channel always works the same no matter which blend mode you choose. There is no mathematical error in the way things work. If a pixel is transparent (alpha = 0) then it will make no contribution, no matter what the blend mode is of the layer it's in. If a pixel is fully opaque (a = 255) then its contribution will be the full effect of the blend mode.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

... and makes me think I need to expand my reading a little.

I've been doing a LOT of research on Paint.NET over the last month. There are so many things that I thought I knew - and found I didn't know them nearly so well as I thought :(

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...