Sign up now! · Forgot password?
RSS/Atom feed Twitter

GIMP's layer math disagrees with mine

This discussion is connected to the mailing list which is provided by the GIMP developers and not related to

This is a read-only list on so this discussion thread is read-only, too.

1 of 1 message available
Toggle history

Please log in to manage your subscriptions.

GIMP's layer math disagrees with mine Henderson, Brad via gimp-developer-list 07 Feb 23:15
Henderson, Brad via gimp-developer-list
2019-02-07 23:15:35 UTC (over 2 years ago)

GIMP's layer math disagrees with mine

Hello GIMP developers -

I have experience with image processing, but I am fairly new to GIMP. I was experimenting with combining layers that have transparency, and the pixel values that GIMP computes do not agree with the equation I've seen posted on GIMP and photoshop web sites.

Here's a specific example. The math here applies to a single pixel, but for convenience I'll assume that I have images with the same pixel value everywhere. Start with a 4-band image, where the RGB values are all 128, and the alpha layer is all 255, or as a fraction 1.0. Use that as your base layer. Now put on top of that another layer that has RGB values of 0 and an alpha value of 191, or as a fraction, 191/255 = 0.749. When those layers get combined in GIMP, I thought it was done mathematically using the following equation:

output value = basePixel*(1 - topAlpha) + topPixel*topAlpha = 128*(1 - 0.749) + 0*0.749 = 32.

That's not what I get with GIMP. I get a value of 66. Apparently I'm using the wrong equation. Does anyone know the answer?

For what it's worth, the blend mode is set to normal.