GIMP - change color of object preserving feathering


Question

I have an .xcf image and I like to change the color of some objects within it. The objects are mostly one solid color with the edges feathered into transparency. I.e. all pixels in the object are white with most pixels fully opaque and some with transparency.

I've tried to change the objects' color using the color select tool + bucket fill but this destroys the feathering. Is there a way to get the gimp to change just the color but preserve the transparency?

The actual objects that I have are multiple bits of text all at different sizes and rotations that I have merged into one layer. So it is no use re-adding the feathering as this messes up the text quite noticeably.

Thanks

1
24
6/14/2011 5:47:00 PM

Accepted Answer

Try checking the "Lock" option for the layer (which prevents transparent pixels from being filled), then use the Fill Bucket. If that doesn't work, you may have to take a slightly roundabout approach. From what I can tell (I'm taking this from the documentation as I don't have Gimp installed) this will work:

Add a black layer below your feathered white layer, so that what you see is your white feathered object against a black background.

Right-click one of the RGB channels (they should all be the same) and choose "Duplicate Channel" to make an alpha channel that looks like your regular composite view.

Delete or hide the black layer.

Create a fresh blank layer, then turn your saved channel into a selection by right-clicking and choosing "Channel to Selection".

Fill the selection with your new color, and hide the white layer.

(Note: In Photoshop, you add Shift to the keyboard shortcut for Fill -- the Backspace/Delete key plus Ctl/Cmd for background color or Alt/Option for foreground -- as the quick way to fill while preserving transparency. The Gimp UI does things a differently, but I would expect there is a similar keyboard shortcut somewhere, if you poke around in the documentation.)

18
6/14/2011 10:06:00 PM

You could also convert the transparency into a layer mask using Layer → Mask → Add Layer Mask... and selecting the "Transfer layer's alpha channel" option.

This will let you edit the color and transparency components of the layer independently. In particular, to recolor an object, you can just select a region around it and fill it with a solid color.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
^