1

In GIMP version 2.8, I have an image with a black foreground, and a transparent background. I want to set the entire foreground to red, instead of black. What's the simplest way of doing this?

I have tried using the fuzzy select tool and doing a bucket fill on the selection, but this doesn't seem to select the entire foreground. After the bucket fill, there is still a black line around the edge of the foreground image. So it seems that the fuzzy selector didn't select the entire foreground. On closer inspection, the edges of the foreground are not perfectly black, but have some grey pixels. But when using the fuzzy selection, I set a very high threshold (250), so I would have thought this this would select the entire foreground, including the grey pixels.

Any help? Thanks!

2 Answers 2

4

The gray pixels aren't grey, they are partially transparent black pixels. If you replace black, you want to keep that partial transparency because this is what gives smooth edges. And there is an easy solution:

  • Set the alpha-lock of the layer (this is the checkerboard icon at the top of the Layers list).
  • Do not use selection.
  • Bucket-fill the layer with the required color. The alpha-lock will preserve the opacity of the pixels.

A different solution (that gives a strictly identical result):

  • On the foreground layer: Layer>Transparency>Alpha to selection
  • Hide/Discard the foreground layer
  • Add a new transparent layer
  • Bucket-fill the selection on that layer.
0

You should select the background with the color select tool, then invert the selection (CTRL+I) and there you go, you have selected the entire foreground, including the 'grey' pixels, which actually are black pixels with transparency.

5
  • ... and you get jagged edges, because your pixels are either fully selected or not selected at all.
    – xenoid
    Jun 30, 2016 at 9:16
  • @xenoid You can't half-select a pixel. I get what you want to say, but you say it incorrectly Jun 30, 2016 at 14:33
  • how do you call a pixel where the selection mask is 50% (or 127/255)?
    – xenoid
    Jul 1, 2016 at 20:10
  • @xenoid feather selected. Just that Jul 2, 2016 at 12:09
  • 1
    feathering is just a Gaussian blur on the selection mask. This is one of many ways to get partially-selected pixels.
    – xenoid
    Jul 2, 2016 at 17:35

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.