Layer masks in GIMP (GNU Image Manipulation Program) provide a flexible way to edit layers that combine within a document to produce more attractive composite images.
The Advantages of Masks and How They Work
When a mask is applied to a layer, the mask makes parts of the layer transparent so that any layers below show through.
This can be an effective way to combine two or more photos to produce a final image that combines elements of each of them. However, it can also open up the ability to edit areas of a single image in different ways to produce a final image that looks much more striking than if the same image adjustments had been applied universally to the whole picture.
For example, in landscape photos, you could use this technique to darken a sky at sunset, so that the warm colors don’t burn out while lightening the foreground.
You could achieve similar results of combined layers by deleting parts of the upper layer rather than using a mask to make areas transparent. However, once part of a layer has been deleted, it cannot be undeleted, but you can edit a layer mask to make the transparent area visible again.
Using Layer Masks in GIMP
The technique demonstrated in this tutorial uses the free GIMP image editor and is well suited for a range of subjects, particularly where the lighting varies significantly across a scene. It shows how to use layer masks in a landscape image to combine two different versions of the same image.
Prepare a GIMP Document
The first step is to prepare a GIMP document that you can use to edit specific areas of an image.
Using a photo of a landscape or similar that has a very obvious horizon line will make it easy to edit the top and bottom portions of the image so that you can see how this technique works. When you are comfortable with the concept, you might try applying it to more complex subjects.
- Go to File > Open to open the digital photo you want to work with. In the Layers palette, the newly opened image appears as a single layer.
- Next, select the Duplicate Layer button in the bottom bar of the Layers palette. This duplicates the background layer to work with.
- Select the Hide button (it appears as an eye icon) on the top layer.
- Use the image adjustment tools to edit the visible bottom layer in a way that enhances one specific part of the image, such as the sky.
- Unhide the top layer and enhance a different area of the image, such as the foreground.
If you’re not too confident with GIMP’s adjustment tools, use the Channel Mixer mono conversion technique to prepare a similar GIMP document.
Go to File > Open to open the digital photo you want to work with. In the Layers palette, the newly opened image appears as a single layer.
Next, select the Duplicate Layer button in the bottom bar of the Layers palette. This duplicates the background layer to work with.
Select the Hide button (it appears as an eye icon) on the top layer.
Use the image adjustment tools to edit the visible bottom layer in a way that enhances one specific part of the image, such as the sky.
Unhide the top layer and enhance a different area of the image, such as the foreground.
Apply a Layer Mask
We want to hide the sky in the top layer so that the dark sky in the lower layer shows through.
- Right click on the top layer in the Layers palette and select Add Layer Mask.
- Select White (full opacity). You’ll now see that a plain white rectangle appears to the right of the layer thumbnail in the Layers palette.
- Select the Layer Mask by clicking and holding on the white rectangle icon and then press the D key to reset the foreground and background colors to black and white respectively.
- In the Toolbox, select the Gradient Tool.
- In the Tool Options, select FG to BG (RGB) from the Gradient selector.
- Move the pointer to the image and place it on the level of the horizon. Click and drag upwards to paint a gradient of black on to the Layer Mask.
- The sky from the lower layer will now be visible with the foreground from the top layer. If the result isn’t quite as you’d like, try applying the gradient again, perhaps starting or finishing at a different point.
Fine Tune the Join
It may be the case that the top layer is a little brighter than the bottom layer, but the mask has obscured it. This can be adjusted by painting the image mask using white as the foreground color.
Right click on the top layer in the Layers palette and select Add Layer Mask.
Select White (full opacity). You’ll now see that a plain white rectangle appears to the right of the layer thumbnail in the Layers palette.
Select the Layer Mask by clicking and holding on the white rectangle icon and then press the D key to reset the foreground and background colors to black and white respectively.
In the Toolbox, select the Gradient Tool.
In the Tool Options, select FG to BG (RGB) from the Gradient selector.
Move the pointer to the image and place it on the level of the horizon. Click and drag upwards to paint a gradient of black on to the Layer Mask.
The sky from the lower layer will now be visible with the foreground from the top layer. If the result isn’t quite as you’d like, try applying the gradient again, perhaps starting or finishing at a different point.
Select the Brush Tool, and in the Tool Options, select a soft brush in the Brush setting. Use the Scale slider to adjust the size as required. Try reducing the value of the Opacity slider also, as this makes it easier to produce more natural results.
Before painting onto the layer mask, select the small double-headed arrow icon next to the foreground and background colors to make the foreground color white.Select the Layer Mask icon in the Layers palette to ensure that it is selected and that you can paint onto the image in the areas where you want to make transparent parts visible again. As you paint, you will see the Layer Mask icon change to reflect the brush strokes that you are applying, and you should see the image changing visibly as transparent areas become opaque again.
Get the Latest Tech News Delivered Every Day