kasploosh.com

Color to Alpha with GIMP 2.10 leads to washed out appearance

The original image, which we want to make transparent but not change the values of black and white.

I like to use GIMP (GNU Image Manipulation Program) to create and edit images because it is free software, it’s easy to install on Debian, and it is fun to use when you get the hang of it. GIMP is excellent software for editing images.

One thing I rely on is the “Color to Alpha” function. This allows you to take a flat image and remove a certain color from it, replacing that color with transparency.

A common job using this function is to subtract all white from an image, and replace the white with transparency. Then add back a white layer under the transparent layer, and the image looks the same as it did before, but now separated onto two layers. You can paint under the original image.

For the purposes of a demo, here is an example black and white image which we would like to turn transparent:

GIMP 2.10 changes Color to Alpha

Using Color to Alpha in GIMP 2.10 leads to a washed out appearance when the image is reassembled

When I got GIMP 2.10, I noticed the Color to Alpha did not give the reliable results that I had used many times.

If I took an image, removed the white, and put a white layer underneath, I should get the exact same image back. This is how it worked in GIMP 2.8. But in GIMP 2.10, the result was noticeably washed out looking:

Another related problem in GIMP 2.10

Because Color to Alpha was not working reliably, I tried an alternative strategy using layer masks.

Convert the image to black and white. Invert the colors. Create a new layer and fill it with black. Add a layer mask. Copy the inverted layer and paste it in as the layer mask. Add a white layer under the black layer.

The result should look just like the original black and white image. But it does not, it looks washed out and like the layer mask has been inaccurately applied.

I believe this is just another way to arrive at the same problem we have already described.

Online search for answers

Online search for answers turned up this post.
Click to enlarge

I searched online for this problem, and found several people who had the same problem, but did not find an answer.

Next I searched again using a slightly different approach and ended up reading a thread that talked about changes to GIMP 2.10 that are caused by changing the graphics framework to GEGL (Generic Graphic Library). GEGL is the new graphics framework for GIMP that is graph-based and non-destructive.

Now I found a post by Elle that suggests the problem has to do with new default blend modes for layers. See adjacent image for the full post I thought was the most useful. And here is a link to the actual post where I found it:

Fixing Color to Alpha for GIMP 2.10

Change the Composite Mode on the transparent layer to RGB Perceptual to return the image to normal.

Here is my way to work with Color to Alpha in GIMP 2.10:

  • Start with a new flat image.
  • Use Color to Alpha to remove white from the image.
  • Add back a white layer under the newly transparent layer.
  • If the result looks washed out:
    • Right click on the washed out layer in the layers dialog.
    • Under Composite Space, choose “RGB (Perceptual)”
  • The image should now look correct.

This makes the Color to Alpha function work again like it did before, which is great because it’s very useful.

I used the “compare” tool of imagemagick to compare the new image to the original, and according to compare the images are now identical.

compare image1.png image2.png difference.png

Conclusion

Color to Alpha is working again in GIMP 2.10
Let the games begin!

I don’t know enough about what the different blend modes are to know whether the new default blend mode is just wrong for what I'm doing, or something more akin to a bug. It seems to me the behavior of Color to Alpha that I am accustomed to is more correct.

I mainly want to get this answer out there so people can find it. When I searched I did not find a clear workaround.

16311.87487