GIMP: Turn black to another color with Screen mode
I needed to turn some small black-on-white icons to blue-on-white. Simple task, right? Except, not really. If there are intermediate colors that are not pure white or pure black -- which you can see if you magnify the image a lot, like this 800% view of a 20x20 icon -- it gets trickier.
You can't use anything like Color to Alpha or Bucket Fill, because all those grey antialiased pixels will stay grey, as you see in the image at left.
And the Hue-Saturation dialog, so handy for changing the hue of a sky,
a car or a dress, does nothing at all -- because changing hue
has no effect when saturation is zero, as for black, grey or white.
So what can you do?
I fiddled with several options, but the best way I've found is the Screen layer mode. It works like this:
In the Layers dialog, click the New Layer button and accept the
defaults. You'll get a new, empty layer.
Set the foreground color to your chosen color.
Drag the foreground color into the image, or do Edit->Fill with FG Color.
Now it looks like your whole image is the new color. But don't panic!
Use the menu at the top of the Layers dialog to change the top layer's mode to Screen.
Layer modes specify how to combine two layers. (For a lot more information,
see my book, Beginning GIMP).
Multiply mode, for example, multiplies each pixel in the two layers,
which makes light colors a lot more intense while not changing dark
colors very much.
Screen mode is sort of the opposite of Multiply mode: GIMP inverts
each of the layers, multiplies them together, then inverts them again.
All those white pixels in the image, when inverted, are black (a value
of zero), so multiplying them doesn't change anything. They'll still be
white when they're inverted back. But black pixels, in Screen mode,
take on the color of the other layer -- exactly what I needed here.
Intensify the effect with contrast
One place I use this Screen mode trick is with pencil sketches. For example, I've made a lot of sketches of Mars over the years, like this sketch of Lacus Solis, the "Eye of Mars". But it's always a little frustrating: Mars is all shades of reddish orange and brown, not grey like a graphite pencil.
Adding an orange layer in Screen mode helps, but it has another problem:
it washes out the image. What I need is to intensify the image underneath:
increase the contrast, make the lights lighter and the darks darker.
Fortunately, all you need to do is bump up the contrast of the sketch layer -- and you can do that while keeping the orange Screen layer in place.
Just click on the sketch layer in the Layers dialog, then run Colors->Brightness/Contrast...
This sketch needed the brightness reduced a lot, plus a little more
contrast, but every image will be different. Experiment!
[ 18:22 Mar 07, 2015 More gimp | permalink to this entry | ]