5

I have simple images in black and transparent and would like to change it to white and transparent. And I want to keep the transparency (80% black and 20% transparent >> 80% white and 20% transparent, 30% black and ...). I tried the fill bucket, but I wasn't successful.

As far as I remember, in photoshop I would use layer color overlay.

How can I do this in gimp?

Bernhard
  • 171
  • 1
  • 9

2 Answers2

17

The general solution is to set the alpha-lock on the layer (checkerboard icon at top of the layer list) and then to bucket-fill the layer with the new color (or pattern, or gradient). The alpha-lock will make the paint only change the RGB channel but not the alpha one.

xenoid
  • 8,396
  • 3
  • 23
  • 49
  • I tried this on a completely blue graphic. I wanted to change the blue to white while keeping the transparent edges. I lock the alpha channel on the one and only layer then use the bucket tool to paint it white. The opacity on the bucket tool was set to 100. It painted the layer a lighter blue. I hope the open source world comes up with a better alternative to gimp in the future because I've been using it sparsely for over 10 years and what it lacks in intuition it makes up for with 20 different tutorials that don't work. – aaaaaa Aug 04 '23 at 01:51
  • @aaaaaa I get your result if the bucket-fill blend mode (just above the Opacity slider) is set to something else than `Normal` (for instance `Overlay`). – xenoid Aug 04 '23 at 07:03
  • I went back to double check after having used a different image from the web and this worked. I then tried again on the old image and reproduced my issue. Both were against a png file with the same settings as far as I can tell. Here's before: https://i.imgur.com/SRjYX0d.png and after: https://i.imgur.com/y5L5Me8.png. I don't think it's worth the time to dig into why gimp is behaving this way. – aaaaaa Aug 04 '23 at 15:07
  • 1
    @aaaaaa Your problem image is color-indexed (see title bar), while the one that works is a plain RGB image... So any color you use is shoe-horned into one of the color in the image colormap. Since there is no white you get the closest there is....See [this](https://www.gimp-forum.net/Thread-What-are-color-indexed-images-a-k-a-Why-are-my-colors-all-wrong) for details and solutions. – xenoid Aug 04 '23 at 15:12
  • haha what a feature – aaaaaa Aug 04 '23 at 15:16
  • @aaaaaa Completely normal behavior to support GIF. Adding colors that you can't save wouldn't be useful. – xenoid Aug 04 '23 at 15:25
  • telling the user you're trying to use a color that isn't mapped would be more useful. – aaaaaa Aug 04 '23 at 15:48
  • In the article you link, at the top it reads "You are likely reading this because Gimp is doing weird things with your image colors". Clearly this is a UX issue, not sure why you're trying to defend its "completely normal behavior" – aaaaaa Aug 04 '23 at 15:50
  • @aaaaaa The "weird things" are from the point of view of the readers, until they understand it's not so weird when they see where where that comes from. The problem isn't Gimp but the limitations of the GIF format (color-indexing in Gimp is designed to edit GIF). – xenoid Aug 04 '23 at 15:57
  • You're right, UX issues aren't GIMP's problems. They're the user's problems – aaaaaa Aug 04 '23 at 15:58
0

I found the solution:

Colors > Invert

does what I want. Lucky me that I want to turn black to white. Other colors would not work this way. And I still don't know how I would do it with other colors.

Bernhard
  • 171
  • 1
  • 9