Search code examples
transparencygimp

Gimp 2.8.22: Change Color & Keep Transparency


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?


Solution

  • Gimp 2.8 solution:

    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.

    Edit: Gimp 2.10 solution:

    Create a group, and put in it:

    • At the bottom, the layer(s) that define the shape
    • At the top, a layer filled with the color/pattern/image. Then edit the attributes of this layer to set Composite mode: Clip to background

    Like this:

    The big benefit of this method is that the color and the shapes are independent, you can edit the colors later (for instance, you can move the color layer to shift a pattern slightly) and you can edit the shapes later as well (change the font of the text, etc...), all this with the image updated in real time.