16

I’m attempting to add color to some greyscale icons (i.e. all three channels are identical). I want to map the colors such that the brightest grey becomes one specific color, the darkest grey becomes another specific color, and all the greys in between are translated into colors along the gradient between those two specific colors.

I’ve never used GIMP in this manner before and, while it looks like I should be able to use the Colors → Curves tool for this, I can’t figure out the specifics even after reading the docs and googling around a bit.

2
  • I always assumed the lightest and the darkest colors of the image were mapped to the gradient! Good to know they aren't. Photoshop and Gimp behave the same way here. I used the levels tool to "stretch" the images value ranges to see if I got the same inaccuracy but got the exact same colors I had chosen before. Maybe the inaccuracy you mention is due to the curves tool?
    – leugim
    Mar 21, 2011 at 3:23
  • @leugim — That was my first thought as well, but I went back and checked; it really was pure white and pure black. GIMP's gradients are a bit of a mystery to me anyway, so I'm blaming them for the time being. ;-)
    – Ben Blank
    Mar 21, 2011 at 6:32

3 Answers 3

18

I think what you are searching for is called gradient map.

  • In Photoshop: Image → Adjustments → Gradient Map.

  • In GIMP:

    1. Select a gradient or create one in the Gradients dialog (Ctrl + G).
    2. Colors → Map → Gradient Map.
1
  • 1. It appears to map the full range of possible Values (0.0 through 1.0), not just what's being used in the image. This was easy enough to work around by using the Curves tool to "stretch" my images' Value ranges such that the darkest color became (0, 0, 0) and the brightest color became (255, 255, 255). 2. It doesn't seem to be exact? The colors I used in my gradient were (7, 7, 11) and (70, 58, 96), but the colors in the final image were (6, 6, 10) and (69, 59, 95). Mind you, no one's holding a colorimeter to my work, so this is plenty close enough! Just thought it a bit odd.
    – Ben Blank
    Mar 20, 2011 at 23:51
1

I had the same need and I managed to do it using GIMP and Colors > Curves functionality.

In the Curves screen, Click on Channel and select any of Red, Green, Blue, then you can adjust the curve to blend the colors based on the grey level (horizontal axis). For example, if you want to have black = red, white = blue and middle level = green, you would do the following : - In the red channel, make a curve starting high in the first quarter then going down to the middle. - In the blue channel, make a curve that mirrors the red channel curve - In the green channel, make a gaussian curve centered in the graph and dropping on each side at one quarter.

With the preview you can easily adjust it to your needs.

0

In GIMP, Colors - Components - Compose. Note your files must be in grayscale first

1
  • 3
    Can you add some more detail? I see that the Compose tool can add color to a grayscale image, but it isn't clear to me how to map it to a gradient.
    – Ben Blank
    May 17, 2021 at 17:08

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.