When you want to extract a person with long hair from the foreground, it’s often very difficult to select the hair as they are very thin and transparent and Everywhere
. Using the lasso or the magic wand would be just impossible and forget about the path tool!
Even the method introduced in Digital Photo Editing: Easy Selection is useless in that case.
What you need is a way to automatically select all this small bits of the picture and have semi transparent selections [1]. This is the technique introduced in this tutorial.
In this video tutorial, I show a full foreground extraction task that gets to this quick montage:
The idea is to use the inverted colour of the image to play with the colour contrast and automatically create a grayscale silhouette that can be used as to mask the hair.
You can jump to around 3mins in the video if you want to see only this technique as the video recaps quickly this technique to cut out the rest of the model with a layer mask.
- This video presents the steps to take to extract thin or semi transparent shape with Gimp.
In this example, we had a very easy almost white background so it’s easier to see the effect. However, this method will also work with a more complex background. You might however have to use it multiple times on smaller parts of the image with different settings for the curve and levels, depending on the colour contrast available.
Here is the different steps to follow:
- duplicate the layer you want to cut out,
- use the rectangular select tool and select around the specific part you want to work on and limit the layer boundaries to selection (under the layer menu),
- We are now going to transform this layer to a mask for the hair. As we want a black and white mask, with the hair in white and the background in black, we start by inverting the colours of the layer [2],
- the next step is to augment the black/white contrast to remove the unwanted details of the background. This is done by playing with the curve tool. Draw an S curve [3] and play with the points to get as much details as possible in the hair and remove all the noise in the black,
- you should have a blueish/black layer, as we want it to be a black and white mask, desaturate with average values,
- there will be some part of the layer that didn’t come out white (like, in our example, the face), just draw in white with the paintbrush over these parts, beware not to destroy the work we just did on the hair. The important part of the hair mask are the hair "borders", so you can also go and paint the hair "mass" in full white, keeping the greyscale levels on the border,
- if you still have too much noise in the background, you can use the threshold tool to clean it a bit. However, this tool will loose some of the details in the hairs, so don’t go too far with it,
- you will now have a pretty good black and white layer that can be transferred to a layer mask to extract the hair. The easiest is to go to the channel list and transfer one of the channel to selection,
- go to your original layer, add a layer mask, filled in black (full transparency),
- fill the selection, in the layer mask, with white colour. Only the hair and the head should now be shown from the original layer,
- you can erase the layer we used to build the mask, and work directly on the mask of the original layer to extract the rest of the body (as shown at the beginning of the video).




