25

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

3
  • I think, from a technical standpoint, "feathered into white, simulating a transparency" would be the proper description of what you have. In CG, "transparency" is an attribute of an image or layer within an image that is represented by (for instance) a grayscale mask, and can be adjusted without altering the actual image data.
    – horatio
    Jun 14, 2011 at 19:28
  • @horatio Thanks, but I'm confused. Are you saying there is a way to do this? I dont think you are correct when you say it is "feathered into white, simulating a transparency". The solid pixels are coloured white and at the edge, the feathered ones are white semi-transparent. Ie you can add a background layer, and no matter what background colour you choose the text will feather correctly. Jun 14, 2011 at 20:13
  • I misunderstood what you wrote then.
    – horatio
    Jun 14, 2011 at 20:18

7 Answers 7

20

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.)

2
  • Thanks @AlanGilbertson the 'lock' option was just what I was looking for. Jun 15, 2011 at 13:15
  • Glad to help. I don't use Gimp, so I was extrapolating from the way things work in Photoshop. The Gimp docs aren't entirely clear. Jun 15, 2011 at 18:38
19

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.

1
  • I was working with a png and didn't have the original xcf available. This method did exactly what I needed.
    – jcbwlkr
    Nov 29, 2013 at 20:38
9

I think I found the easiest way to do this (at least for me), running GIMP 2.8.3.

  • Open the image to change.
  • Select the pen.
  • In the upper right, select the tab that's 3 layers: RGB.
  • In the cell regarding alpha, click it so it's no longer selected.

Now, when you draw, the colours can change, but the alpha won't.

  • Draw the desired colour over the existing pixels. Make sure to get the whole image.

Voila! It's in another colour, but the alpha stays the same.

3
  • 1
    This is the easiest and most intuitive answer here. Thanks!
    – SMBiggs
    Aug 30, 2017 at 5:55
  • And it works just fine for pencil, paintbrush, and bucket-fill.
    – SMBiggs
    Nov 10, 2017 at 19:12
  • Thanks for a simple answer that works. If I could just add that this can work if there's more than one colour in the area (such as changing the background colour while preserving the text colour) use Select by Colour Tool (Shift + O) before locking the alpha channel Aug 15, 2019 at 14:11
8

Personally my favorite approach is Color->Hue, Saturation... and use sliders.

0
4

I just figured this out too. I'm designing my logo and have a transparent background so I can apply the logo anywhere.

If your background is already transparent, then lock it and you can use the Bucket Fill tool. Retains the feathering and you can use any ol' color you like!

1
  • This looks like it should be a comment on Alan's solution, not a new answer.
    – e100
    Nov 27, 2012 at 18:45
1

your background is already transparent, then lock it and you can use the Bucket Fill tool. Retains the feathering and you can use any ol' color you like!

0

If you have an option to merge a layer by "darkening only," you might eliminate the white halo effect you are seeing, but I doubt it will be perfect.

2
  • What white halo effect? Jun 14, 2011 at 20:16
  • I misunderstood the problem. I actually thought you were trying to bucket fill the background
    – horatio
    Jun 14, 2011 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.