Warning: preg_replace(): Compilation failed: nothing to repeat at offset 4 in /usr/home/esteveb.com/web/pmwiki.php on line 291 esteveb.com :: Tutorials-Articles / Converting an image to B&W

(:cell width=48:)

Tutorials & articles



Converting an image to B&W

When converting an image to B&W, The Gimp gives you an array of options to get the results you want.

Each one has its pros and cons.

Convert when importing with UFRaw

If you work with RAW files (NEFs in Nikon’s world), UFRaw will give the first opportunity to do this, but I find the options quite simple: basically you can play with the saturation, so I usually import the NEF in full color and I make the conversion inside The Gimp:

We’ll suppose that we don’t do the conversion in UFRaw (it has more advanced options than just playing with the saturation. More on this on another tutorial).

Once you have the image in The Gimp, you have several choices.

The most straightforward is to use the Image > Mode > Grayscale menu. This menu will convert your image to BW by computing the weighted-average gray for every pixel of the picture.
As you know, the image in the computer is created by mixing Red, Green and Blue colours. For example, full Red, full Green and full Blue is white.
When you use the Grayscale menu, the Gimp will do the following:

RedValue*21% GreenValue*72% BlueValue*7%

In Gimp 2.4, it use to be RedValue*30% GreenValue*59% BlueValue*11%

This will give it the grayscale value. The weights have their explanation. The colour that the human eye “sees” better is Green, followed by Red and finally Blue. Thus, we give more importance to the colours we “see” better, yielding better visual results this way.

While this is a really simple method to convert your image to B&W, there are more interesting ways to do it. Everything, but, spans from such a calculation, that is: playing with the weights of each colour.

Color > Components > Decompose

There is a plugin in The Gimp that breaks down the image in 3 (or more) different images, one for each component of the image.

When using this menu, with the default options (RGB), you get an image with 3 layers, each one containing a channel of the image, converted to gray. You can keep the one you want. Usually, the Green component has the best image for the reasons explained above.

The plugin has some other options:

  • RGBA: This one gives 4 layers. The last one is the alpha channel (transparency channel) of the image.
  • HSV: 3 layers, Hue, Saturation and Value. The “Value” layer usually contains the only useful image.

For the record:

V = max(Red,Green,Blue)
S = max(Red,Green,Blue) - min(Red,Green,Blue)/max(Red,Green,Blue)
H = Depends on which one is the maximum (Red,Green or Blue)

  • HSL: Again, 3 layers. Hue, Saturation and Lightness. The exact calculations are beyond (I think) the scope of this tutorial. You can find a detailed description in this .
  • CMY / CMKY: Usually in the printing world, people works in the CMYK space. In this space, the colours are substractive (i.e., we obtain a colour by substracting rather than by adding as in the RGB space).
    Using this option we get 3 or 4 layers: Cian, Magenta, Yellow and (just in CMYK) Black.
  • Alpha: We get the alpha channel (the transparency layer) of the image.
  • LAB: LAB is a colour space designed to mimic the human vision. It uses complex formulas (at least, more complex than HSV/CMYK/etc…).
  • YCbCr: This colour space was designed to transmit video images. The Y component is the Luma, and is usually transmitted at high resolution since the human eye is specially sensitive to the Luma, and Cb and Cr carry the colour information and can be transmitted at lower resolutions/bandwidths.

The “Foreground as registration color” option leaves the pixels that have the foreground colour as black in the split. I cannot figure out a use for this…


You can also use the Colors > Desaturate menu. This will display the following window:

You just have 3 different options.:

  • Lightness: Each pixel is computed as 1/2 *(max(R,G,B)-min(R,G,B)).
  • Luminosity: Each pixel is computed as 21%*R 71%*G 7%*B. The result is the brightest of the 3 different methods.
  • Average: The Gimp computes the average of each pixel ( (R G B)/3 ).

The results are different in each image, so it’s difficult to recommend a method. Just test, it’s easy :)

Channel mixer

The Channel Mixer (Colors > Components > Channel Mixer) is the most powerful tool to convert to B&W. It allows you to set the weights of each channel.

The Channel Mixer has more uses. We’ll concentrate on B&W conversion, so we must click on the “Monochrome” checkbox.
Now we can play with the sliders, to set the weight of each component in the conversion.

Note that we can set the weight to more than 100% (up to 200%), so we can end up with a very bright image.
If we click on “Preserve Luminosity”, the program takes care that the sum of all the values is lower than 100%, keeping the relative weight of each channel.

Other tutorials and articles from this section:

© 2021 Esteve Boix | Powered by PmWiki | Original skin Barthelme theme by Scott and ported by Chi Shang.