GIMP provides a very handy way of replace or rather Rotating color from one range to another but rotating the range of black is rather hard from this. The Gray option is a bit hard in a way that it only does gray colors.
For example to make effective layer masks that has got a big range of colors on the subject as well as the background, it would be very useful if you could replace a certain range(that is the amount of intensity of blackness that a color has) with a black or white. A lot of youtube videos have tutorials on how to remove backgrounds on an image but a lot of them already have some clear background that on saturating give a perfection isolation between complex objects like hair and the background.
Therefore, if we could replace a certain range of gray/black of colors with the desired white/black color(to a 100% of intensity) it would be perfect to create a perfect layer mask. Is rotating colors the way to do this or are there any other ways?(although GIMP having the "color exchange", it is very hard to control.)
for example, there are 256 shades of gray in an 8 bit image, but we've got to replace the shades of say 1 to 50 to white and the rest to black then how can we achieve this?

  • 1
    I'm not sure I understand your question. Could you add an example?
    – Tobl
    Jul 4, 2016 at 10:38
  • @Tobi, i edited my question
    – bzal
    Jul 5, 2016 at 7:44

1 Answer 1


The best way to replace a range of gray values (even very dark gray) with some color is to use Color>Map>Gradient map

But if you just want a mask, duplicate the layer, Color>Desaturate and then use the Threshold tool, or Brightness/Contrast for a smoother transition, or even the Levels or Curves tools.

  • 1
    could you please demonstrate this or perphaps point to a link that does?
    – bzal
    Jul 5, 2016 at 11:57
  • 1
    @bzal Selecting hair is always a hairy process:). This requires partial selection on many pixels... in case of high contrast with a uniform background, color-to-alpha can be attempted but even this requires luck. I heard that the most efficient way is to use the improved version of foreground selector tool (aka RGGJAN fork, AFAIK included in the builds from at partha.com, and now part of 2.9).
    – xenoid
    Jul 6, 2016 at 11:54
  • 1
    @bzal As I said, the foreground selector, but if you want a decent result on hairs, you have to use the enhanced one.
    – xenoid
    Jul 7, 2016 at 15:10
  • 1
    @bzal RGGJAN's fork if 2.8, or experimental 2.9
    – xenoid
    Jul 8, 2016 at 11:42
  • 1
    @bzal No,, if that clears up things
    – xenoid
    Jul 25, 2016 at 10:05

Your Answer

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

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