GIMP Tutorial – Converting Color Images to Black and White

CONVERTING COLOR IMAGES TO B&W

Intention

In this tutorial I’ll show you some different ways to convert color RGB images to B&W:

  • the “standard” grayscale conversion operation.
  • the desaturate operation.
  • decomposing to RGB and using any one of the channels.
  • decomposing to HSV and using the Value (V) channel.
  • decomposing to LAB and using the Lightness (L) channel.
  • using the Channel Mixer filter.

We’ll examine each of these in turn.

The Procedure

Here is an example image, loaded into GIMP. I thought it might look nice as a black and white image.

Via Grayscale

Here is what I get if I use the standard mode change to grayscale from RGB.

Duplicate the original image (Ctrl+D) and right-click on the copy. Select <Image> Image -> Mode -> Grayscale. I don’t know how this conversion works in GIMP, but I have read that Photoshop uses a standard mix of the RGB channels for their grayscale conversion: RED=30%, GREEN=59% and BLUE=11%. Supposedly this mix accounts for the eye’s sensitivity to different colors. This formula does a pretty nice job in the general case, but some images do not work as well with it, particularly if the green channel component is not strong.

I suspect GIMP uses a similar formula. My experiments with the Channel Mixer (more on this below) support this.

Via Desaturate

Here is what I get if I use desaturate instead. Duplicate the original image (Ctrl+D) and right-click on the copy. Select<Image> Image -> Colors -> Desaturate. Unlike the grayscale mode change above, the channels are not remixed in different percentages, so we should expect different results.

The result is visually different; note the increased contrast in the scales. Also, compare the 100% zoom views at right and in the previous grayscale example. You can see a lot more noise in the desaturated zoomed view (examine the blurred area below the spikes). The reason is that we are getting more blue and red channel noise, whereas in the grayscale mode change operation the algorithm is giving us a remix of 60% of the clean, detailed green channel.

Via Decompose RGB

A third method is to consider the red/green/blue channels of the image. Each one can be represented as an independent grayscale image. Right-click on the original image and select <Image> Image -> Mode -> Decompose. Select the RGB option and click OK.

Here you can see the three channels: red (top), green (middle) and blue (bottom). You can see that the red channel contains most of the luminance information as well as a lot of noise, the green channel has the least noise, and the blue channel has shadows and noise. Often the blue channel has the most noise, but not in this case.

Very often the green channel contains an excellent B&W version of the image. If nothing else, taking a look at the RGB decomposition is important to give you an idea of where the important information is in your image, and where the noise is.

Via Decompose HSV

 

Another possibility is to decompose to Hue/Saturation/Value components and consider the Value image (the other two are not usually useful for this purpose). Right-click on the original image and select <Image> Image -> Mode -> Decompose. Select the HSV option and click OK.

Via Decompose LAB

 

Yet another decompose option: LAB mode. Right-click on the original image and select Image/Mode/Decompose. Select the LAB option and click OK.

The Lightness component is a very interesting one because it contains all of the luninance information (whereas in RGB and HSV some of that information is spread into other components). You can very often see an expanded tonal range and discover hidden detail in the shadows by examining this component.

Not often useful by itself, but it can be combined with other layers for interesting results (see Tips at end of article).

Note: the LAB decompose option was not distributed with the version of GIMP I got (ver 1.2.3). I don’t know whether it comes bundled with newer versions.

Via Decompose CMYK

 

Just for fun I tried decomposing into CMYK. The Black channel is interesting: it resembles a negative.

Via Channel Mixer

The final technique is the Channel Mixer filter. Right-click on the original image and select <Image> Filters -> Color -> Channel Mixer.

You’ll get a dialog box like the one at right. Click the checkbox that says Monochrome. Make sure the preview checkbox is also checked.

Now play around with the levels of the three channels, seeing the results in the preview window. If you don’t want to change the overall brightness of the image then the three values should add up to 100%, but feel free to experiment (checking the “Preserve Luminosity” box will also preserve the overall brightness of the image–see the Tips section below for more explanation of this option). Dialing in Red=30%, Green=59%, Blue=11% ought to give you something that looks nearly identical to what you would get with a mode change to grayscale.

When you have something that looks decent in the preview, click OK. If you don’t like the look of the result, Undo (Ctrl+Z) and reapply the filter with different settings (Shift+Alt+F).

The advantage of the channel mixer is (obviously) flexibility. I like to decompose and examine the individual RGB channels, as we did earlier. That way I can see what is good and bad about each, and then use the channel mixer to combine them accordingly. In this example, I could see that the green channel did not really have much to offer, and had the least contrast in the iguana’s scales; still, I mixed in 30% to help with the noise. I liked the blue channel for the great contrast it adds to the scales. Red’s got a lot of noise, but I mixed in just enough to use some of the contrast and luminance information. You can see from the close up that it isn’t quite as good the grayscale version in terms of noise, but the noise isn’t too bad, and the trade-off is a lot more contrast and interest in the overall tonalities of the image.

 

Tips

  • Once you have a good B&W version of your image you may be interested in adding some simulated film grain.
  • If you are wondering what the “Preserve Luminosity” option does in the Channel Mixer, I have the answer. I was curious myself, and asked the author of the Channel Mixer, Martin Guldahl, about it. This was his reply:Hi Eric:

    The ‘Preserve Luminosity’ option just maintains the luminosity at the same level regardless of the slider values.

    For example, suppose the sliders were are Red:75%, Green:75%, Blue:0%. With ‘Monochrome’ on and the ‘Preserve Luminosity’ option off, the resulting picture would be at 75%+75%+0% =150%, very bright indeed. A pixel with a value of, say, R,G,B=127,100,80 would map to 127*0.75+100*0.75+80*8=170 for each channel. With the ‘Preserve Luminosity’ option on, the sliders will be scaled so they always add up to 100%. In this example, that scale value is 1/(75%+75%+0%) or 0.667. So the pixel values would be about 113. The ‘Preserve Luminosity’ option just assures that the scale values from the sliders always adds up to 100%. Of course, strange things happen when any of the sliders have large negative values.

Other Examples

Left image: The original image.
Right image: Converted using channel mixer (80% green, 20% red).

Left image: The original image.
Right image: Converted using channel mixer.

GIMP Tutorial – Selective Colorization

Intention

In this tutorial I will explain how to convert a color photograph to a B&W one with color restored to selective areas. With the right subject this can give really striking results, as you can see for yourself. This technique is elsewhere referred to sometimes as “hand coloring” 🙂

The basic technique is to duplicate the color photograph, convert the duplicate to B&W, and paste it as a new layer on top of the color image. Add an opaque layer mask and then selectively paint transparency into the upper mask, exposing the color photograph underneath.

 

The Procedure

Here is the original example image, loaded into GIMP.

Step 1

Duplicate the image (Ctrl+D).
By whatever method suits you best, convert the duplicate image to B&W. Once you have gotten the B&W version that you like, change it back to RGB mode (<Image> Image -> Mode -> RGB).

In this example, I tried the channel mixer, but ended up in this case preferring a simple conversion to grayscale (<Image> Image -> Mode -> Grayscale), then back to RGB.

Step 2

 

Open the Layers dialog (Ctrl+L). Make sure that the original color image is selected in the Image drop down box. Click on the new layer button at the bottom of the dialog.
Here I’ve named the new layer “B&W”
Make sure the new layer is selected in the layers dialog.

Step 3

Go to the B&W image and select all, then copy (Ctrl+A then Ctrl+C). Then go to the color image window and paste (Ctrl+V). The B&W image should be pasted into that layer, obscuring the color image.
Click the anchor button in the Layers dialog to anchor the pasted image.
You can close the B&W image window you just copied from now, if you want.

Step 4

 

In the Layers dialog, right-click on the B&W layer and select “Add Layer Mask”. In the Add Mask Options dialog, select White (Full Opacity).

Step 5

 

Make sure that Black is selected as the foreground color in the toolbox. We’re going to paint transparency into the layer mask to reveal the color image below.
Bring up the Brushes dialog (<Image> Dialogs -> Brushes) and select a big brush. In the toolbox, select the paint tool (). Begin painting the interior of the parts you want to be in color.

Step 6

When you get to the edges of the colored part, zoom in to make life easier.

Step 7

 

At the very boundaries of the colored image I typically zoom in to 300% or so. Switch to a small, feathered brush and very carefully paint the edges.

If you only paint a little at a time it makes it much easier to use GIMP’s excellent undo feature if you accidentally stray outside the boundary. If for some reason you can’t undo, don’t worry: just switch to white paint and paint opacity back over your mistake to repair the mask.

Final Step

When your all done, go over the colored part carefully to see if there are any gray (opaque) specks that you missed. Then zoom out and have a look. Voila!

Tips

    • For this kind of fine paint work, a pen tablet like this Wacom one is very useful. For photo retouching you don’t need any bigger than a 4×5 model.
  • In this example I restored the original color from the color image, but there is no reason that you couldn’t paint other colors onto the second layer. Just make sure that the image is selected and not the layer mask in the upper layer of the Layers dialog (click on either the image icon or the mask icon to select the one you want to work on).
  • Try blurring the lower color layer, or running one of the interesting “artistic” filters on it (pastels, oil painting, etc). You probably want to do this before you create the B&W copy.

Other Examples

OLD PHOTO RESTORATION USING THE GIMP (HOW TO REMOVE A MOIRÉ PATTERN)

OLD PHOTO RESTORATION USING THE GIMP (HOW TO REMOVE A MOIRÉ PATTERN)

For this past Father’s day, I worked with my brothers to create a slideshow of our awesome dad. My older brother scanned old photos from slides and photos, I did some of the photo restoration and my younger brother put the photos together and made a fun slideshow.

For this tutorial, I will show you how I did some of the restoration techniques; specifically, I will talk about how to remove Moiré other patterns on the photo. (A Moiré pattern is the dot pattern you see on many old photos. Click here to read the Wikipedia article on Moiré patterns)


The first thing we will do to the photo is to remove the white dots all over the photo. You may observe when working with old photos that often there will be a pattern. Sometimes the pattern is related to the paper material, or how the photo was printed. In the photo you see below, you will notice that there are white repeating dots all over the photo. This is due to the paper texture reflecting light when it was scanned.

Whenever I work on a photo, I like to duplicate the background layer. This allows me to always go back to the original photo so I don’t loose data. It is also useful to use the original layer to compare to the current working layer.

Removing dots or patterns can be done a few different ways. The most effective way would be to use the healing or clone tool. The main problem with this is that it would take hours and hours to do. It is simply not usually worth the time spent doing this. Probably our next best solution would be to do a blur. I did a Gaussian blur and increased the blur until I could no longer see the white dots.

The problem with doing this is that now we have a blurry image. We can help remedy this by applying a sharpening filter to the image. I chose smart redux for sharpening (this is only available if you have the redux/resynthesizer plugin already installed).

Even after sharpening the photo though, it is still a little blurrier than I would like it. This is where I use the original layer. If you change the layer mode to Multiply, it will multiply your blurry (pattern free) layer with your original non blurry (but has white dots) layer. Multiplying these two layers adds a bit of crispness to the photo.

Multiplying the layers makes the photo a bit darker than I would prefer, so I no will use Colors>Levels and adjust the levels until I am satisfied.

At this point I will just apply basic photo restoration techniques such as using the clone and healing brush tool. These tools are useful for removing dust and specks such as what you would commonly see with scanned photos.

Now that I have flattened the image, I am going to sharpen the layer once again.

Look below to see the original scanned photo.

Here is the restored photo after making the edits in the Gimp.

To better show the white dot pattern that was showing up, look below at the zoomed in photo.

Below is the photo after I have applied the Gaussian blur and multiplied the layers.

Gimp Photo Editing Studio – Install Plugin to support RAW formats – UFRaw

This fine tool does a great job of converting a few of the basic RAW formats (Canon, Nikon and a few others) into your choice of outputs.  The tool has quite a few controls for adjusting the image even before opening the converted file in GIMP and it can, indeed, be used as a stand alone program if desired.  In this post I will explain just the basics of opening a photo with some simple changes.  The tool has a LOT of controls beyond the basics, best left for another post.

For the Windows User people to get started, you’ll need to download UFRaw here.  ( Please login to enable this download link)

Before go ahead, please make sure you have also install  GIMP photo editing.

 

Setting Up UFRaw

Setting up UFRaw should be a simple straight forward process.

Just launch the installer and hit next, next all the way till it’s finish.

Here is the step by step screen shot to guide you through.

Download and run UFRaw setup file “ufraw-0.18-setup.exe”.

UFraw will automatic detect where your GIMP install location. Make sure it detects the correct folder. If you install your GIMP to a local other than default folder. Please click “Browser” and point it to the folder where GIMP located.

 

Choose a name for Start menu folder. Normally we just leave this as default.

There are the recommend setting for UFRaw.  It will try to associate to most of the RAW formats. Scroll down to see all the settings.

If you do not have other program look after these RAW formats it would be a good idea just leave these settings as default.

Ready to install. Just hit Install and you will see files being copied to the computer.

When you see this screen means you have done everything correctly.  Now move on to next section to see how to use UFRaw.

Starting Up UFRaw

UFRaw can be found in the GIMP program group in Programs.  It can also be invoked by attempting to open a RAW file from within GIMP.  If you are starting directly with UFRaw, upon clicking the icon the first screen you will notice is a file selection window.  You can use the standard Ctrl and Shift keys to select multiple images.  After selecting the right image, click Open.

1

The Main Screen

The main screen UFRaw opens can be a bit daunting.  Just take a look (click for larger view).

2

There is a LOT going on in this screen shot.  The image of boats I have selected is on the right with the size and current viewing scale below.  That’s the easy part.  Zoom controls are below that.

On the left side, starting at the top is the RAW histogram, then an exposure slider with a few extra buttons.  Next is a row of tabs for making adjustments during conversion.  Below that is a panel that changes depending on which tab you’ve selected.  Finally, at the bottom, is the histogram of the image your are viewing with all changes applied.

On the far right are the Options button, Delete button (be careful!), Cancel, Save and Open in GIMP.

Continue reading

GIMP FAQ – General Information

  1. Is GIMP a GNOME application?
  2. Is GTK+ still under the aegis of GIMP? Was it ever?
  3. Are there any Easter eggs in GIMP?
  4. Is XInput support available?
  5. Does GIMP support art tablets like the Wacom?
  6. Does GIMP have scanner support?
  7. Can GIMP install its own colormap?
  8. GIMP complains about MIT-SHM!
  9. What does “wire_read: unexpected EOF” mean?
  10. Do I need an X server to run in batch mode?
  11. What kind of system do I need to run GIMP?
  12. Is there a bug list somewhere?
  13. Does/could GIMP use high-level graphics operations for its operations?

 

GIMP FAQ – Using GIMP

 

  1. How can I draw a straight line with GIMP?
  2. How can I draw a circle with GIMP?
  3. How can I create an outline around text?
  4. What are layers?
  5. How do I save a selected sub-image to a file?
  6. How do I save an image with an alpha channel?
  7. How do I merge an image from a file to the current image?
  8. How do I get small fonts to look as nice as large ones?
  9. How do I bind keys to menus for shortcuts?
  10. How do I select a layer “sitting” under the mouse cursor? I have more than 400 layers in my image and I cannot remember each layers name.
  11. I hate switching between windows in GIMP. Isn’t there an easier way?
  12. Is there a macro recording interface?
  13. How do I configure my X server to do global gamma correction?
  14. How do I fill with transparent?
  15. How do I draw in a different color?
  16. How can I export my path to SVG?
  17. How do I do something really simple like blur?
  18. I’ve tried to use GIMP but I just don’t get it – what am I missing (and I know nothing about images so dont start about alpha channels and layers, etc).
  19. How can I paint easily an (OutLined) rectangle using GIMP ?.
  20. How do I edit properties of existing guides? How do I move existing guides?
  21. How do I select the layer currently shown under the mouse cursor? Is there a shortcut?
  22. How can you wrap text using the Font tool? There are alignment buttons (including justified) but they have little effect since I can’t work out how to make the text wrap.
  23. Why do I have to make my rectangular selection exactly right the first time? Why can’t I move and resize a rectangular selection using handles?
  24. I recently saw a project that specified files were to be saved in Photoshop “Save for Web -> High (15K to 30K Optimized)” format. Is there an equivalent in GIMP?
  25. How do I get GIMP to be by default image tool i.e. I installed another program & it is now associated to auto-opening them.

Continue reading

GIMP FAQ – Plug Ins

Plug-Ins

  1. What are plug-ins?
  2. How do I add new plug-ins?
  3. How do I build new plug-ins?
  4. Is there a plug-in for … ?
  5. Why did some plug-ins disappear for 0.99.19?
  6. What is Script-Fu?
  7. Where can I learn about Script-Fu?
  8. How do I call one script-fu script from another?
  9. How do I call a plug-in from script-fu?
  10. How do I execute script-fu from batch mode?
  11. What does “procedural-database-error'' in script-fu mean?
  12. What is Net-Fu? Where is it?
  13. Where can I get the fonts I'm missing?
  14. How can I change the GIMP font?
  15. Why don't the Far Eastern fonts work?
  16. What about TrueType fonts?
  17. What is GIMP's native graphics file format?
  18. What other graphics file types are supported?
  19. Is there any way to keep the layers when I save?

Continue reading