How to Use Layer Masks in GIMP

Editing Specific Areas of a Landscape Photo

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.

  1. 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.

    A screenshot of GIMP with a layer highlighted
  2. Next, select the Duplicate Layer button in the bottom bar of the Layers palette. This duplicates the background layer to work with.

    A screenshot of GIMP with the Duplicate Layer button highlighted
  3. Select the Hide button (it appears as an eye icon) on the top layer. 

    A screenshot of GIMP with the Hide Layer button highlighted
  4. 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.

    GIMP image edited background
  5. Unhide the top layer and enhance a different area of the image, such as the foreground.

    GIMP image edited 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.

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.

  1. Right click on the top layer in the Layers palette and select Add Layer Mask.

    A screenshot of GIMP with the Add Layer Mask command highlighted
  2. 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.

    A screenshot of GIMP with the White option in the Add Layer Mask window highlighted
  3. 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.

    A screenshot of GIMP with a layer mask highlighted
  4. In the Toolbox, select the Gradient Tool.

    A screenshot of GIMP with the Gradient tool highlighted
  5. In the Tool Options, select FG to BG (RGB) from the Gradient selector.

    A screenshot of GIMP's Gradient Tool settings with the FG to BG option highlighted
  6. 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.

    GIMP gradient tool on layer mask
  7. 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.

    GIMP layer mask gradient result

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.

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.

Was this page helpful?