Layer Masks Explained in GIMP

A complete walkthrough of layer masks in GIMP - The key to non-destructive editing. Learn how every initialisation option works, how to paint and refine masks, and how to build a non-destructive vignette from scratch.

Intermediate ~30 min read Updated May 2026

What is a Layer Mask?

A layer mask is a greyscale channel attached to a single layer that governs that layer's transparency on a pixel-by-pixel basis - Without permanently erasing or modifying the original pixels. The rule is simple:

Mask Tone
White Fully visible
Grey Partial
Black Fully hidden

Non-destructive: The underlying pixels are preserved entirely. Paint the mask back to white at any time to recover any area that has been hidden.

Reversible: Unlike the Eraser tool, a mask can be undone, repainted, or deleted even after saving the XCF file and reopening it weeks later.

Paintable: Any brush, gradient, or selection can control which areas are visible - Giving extremely fine control over transparency.

Core principle: "Paint with black to hide, paint with white to reveal." This single sentence covers 90% of all mask work.

A layer mask is stored as a separate greyscale image alongside the layer. It does not affect any other layer. When you export to a flat format such as JPEG or PNG the mask is composited into the image, but the original mask data is retained inside the XCF project file.

Mask Initialisation Usage - When Each Option Gets Chosen

Adding a Layer Mask

Method 1: Right-click in the Layers Panel

  1. Select the target layer in the Layers panel (Windows → Dockable Dialogs → Layers if it is not open)
  2. Right-click the layer thumbnail or layer name
  3. Choose Add Layer Mask… from the context menu
  4. Select an initialisation option and click Add

Method 2: Via the Layer Menu

  1. Select the layer in the Layers panel
  2. Go to Layer → Mask → Add Layer Mask…
  3. Choose an initialisation option and click Add
Note: A layer must have an alpha channel before a mask can be added. If the option is greyed out, right-click the layer and choose Add Alpha Channel first.

The 5 Initialisation Options

When adding a mask, GIMP 3.x offers five ways to pre-fill it. Choosing the right one for your situation saves time and produces cleaner results.

Initialise To What It Does Best Used When
White (full opacity) Mask is entirely white - The layer is fully visible. You paint black onto the mask to hide areas. You want the layer visible by default and need to selectively conceal parts of it.
Black (full transparency) Mask is entirely black - The layer is completely hidden. You paint white onto the mask to reveal areas. You are building up an effect gradually, such as revealing a texture by painting it in.
Alpha channel to selection Existing transparency in the layer is converted into the mask. Transparent pixels become black on the mask. The layer already has transparent areas (e.g. a PNG cutout) and you want to start with that shape as the mask.
Selection The active selection becomes white on the mask; areas outside the selection become black. You have already made a careful selection (e.g. with the Scissors tool) and want to convert it directly to a mask.
Greyscale copy of layer The luminance values of the layer itself become the mask. Bright areas are visible, dark areas are hidden. Luminosity masking, HDR blending, or when you want bright highlights to show through while shadows fall away.
Quick decision guide: Use White when you are starting from a fully visible layer and cutting away. Use Black when you are starting from nothing and painting in. Use Selection when you have already selected your subject. Use Greyscale copy for luminosity masking workflows.

Painting on a Mask

Painting on a mask is exactly the same as painting on a normal layer, with one important difference: you are always painting in greyscale values (black, white, or grey) regardless of your colour settings.

Step-by-Step Workflow

  1. Click the mask thumbnail in the Layers panel - It is the small greyscale rectangle to the right of the layer thumbnail. A white border appears around it when it is active.
  2. Select the Paintbrush tool (P)
  3. Press D to reset foreground/background colours to black and white
  4. Press X to swap if you need white on top instead
  5. Paint over the areas you want to hide (black) or reveal (white)
  6. Use a soft brush (low hardness) for natural blended edges; use a hard brush for precise cuts
  7. Reduce the brush Opacity to 40–60% to build up the mask gradually and avoid hard transitions

Viewing the Mask

  • Alt+click the mask thumbnail to toggle viewing the mask as a greyscale overlay - Useful for spotting gaps or unintended grey values
  • Press Alt+click again to return to the normal composite view
  • In GIMP 3.x you can also use Colors → Threshold on the mask to snap soft grey areas to hard black/white

Checking You Are on the Mask

  • The mask thumbnail has a white border when active
  • The title bar shows the layer name followed by (mask)
  • If you accidentally paint on the layer itself (not the mask), undo with Ctrl+Z and click the mask thumbnail before continuing

Switching Between the Mask and the Layer

When a layer has a mask attached you need to deliberately select either the layer or the mask before painting or applying tools. The wrong selection is the most common source of confusion for beginners.

Action How to Perform It Visual Indicator
Activate the layer (to paint pixels) Click the layer thumbnail (the left of the two thumbnails) White border appears around the layer thumbnail
Activate the mask (to paint transparency) Click the mask thumbnail (the right of the two thumbnails) White border appears around the mask thumbnail
View the mask as greyscale Alt+click the mask thumbnail Canvas shows the mask in greyscale instead of the composite image
Show the layer without the mask effect Shift+click the mask thumbnail to disable it temporarily A red X appears over the mask thumbnail
Toggle mask on/off (keyboard) Right-click the layer → Disable Layer Mask (or Enable) Red X indicator in the mask thumbnail

Disabling and Enabling a Mask

Disabling a mask shows the full layer as though no mask exists, without deleting any mask data. This is invaluable when you want to temporarily compare the masked and unmasked state.

  • Right-click the layer in the Layers panel → Disable Layer Mask. A red X appears on the mask thumbnail.
  • Right-click again → Enable Layer Mask to restore it.
  • Alternatively, go to Layer → Mask → Disable Layer Mask / Enable Layer Mask.
Use case: When compositing a subject against a new background, disable the mask to check the original layer content or to reposition the layer without the mask interfering with your view. See also the guide on removing a background for techniques that pair well with masks.

Applying a Mask Permanently

Applying a mask merges the mask into the layer's alpha channel, permanently deleting the hidden pixels. After applying a mask you cannot recover the hidden areas. Only do this when you are certain the mask is final.

  1. Right-click the layer in the Layers panel
  2. Choose Apply Layer Mask, or go to Layer → Mask → Apply Layer Mask
  3. The mask thumbnail disappears; the hidden pixels are removed from the layer permanently
Caution: Applying a mask is destructive. Save a copy of the XCF file with the mask intact before applying if you might need to revisit the mask later. Alternatively, flatten to a new layer (Layer → Flatten Image) on a duplicate rather than applying in-place.

Creating a Mask from a Selection

The fastest and most precise way to create a mask is to first make a selection with any selection tool - Fuzzy Select, Paths, Free Select, or the Foreground Select tool - And then convert that selection into a mask.

  1. Use any selection tool to select the area you want to keep visible
  2. Optionally grow and feather: Select → Grow… by 1–2 px, then Select → Feather… by 2–4 px for softer edges
  3. Right-click the layer → Add Layer Mask…
  4. Choose Initialize to: Selection and click Add
  5. The selected area becomes white (visible) on the mask; everything else becomes black (hidden)
  6. Refine by painting white or black onto the mask with a soft brush
Inverting the selection before adding: If you selected the background instead of the subject, go to Select → Invert (Ctrl+I) before adding the mask so the subject is white and the background is black.

Inverting a Mask

Inverting a mask swaps all black and white values: previously hidden areas become visible and vice versa. This is useful when you realise you masked the wrong thing after the fact.

  1. Click the mask thumbnail in the Layers panel to make it active
  2. Go to Colors → Invert (or press Shift+Ctrl+I on Linux/Windows, Shift+Cmd+I on macOS)
  3. Black areas become white and white areas become black - The mask is now the inverse of what it was

You can also use Layer → Mask → Invert Mask from the menu, which performs the same operation.

Practical Example: Non-Destructive Vignette

A vignette darkens the edges of a photo to draw the eye towards the centre. Using a layer mask keeps the effect fully adjustable and non-destructive.

Non-Destructive Vignette Step-by-Step Practical
  1. With your photo open, go to Layer → New Layer… and name it "Vignette". Set the fill to Black. Click OK.
  2. The canvas turns black. Drag the Vignette layer to the top of the layer stack.
  3. Right-click the Vignette layer → Add Layer Mask… → choose White (full opacity) and click Add.
  4. Click the mask thumbnail in the Layers panel to activate the mask.
  5. Select the Gradient tool (G). In the Tool Options, set the gradient type to Radial and choose the FG to BG (Black to White) gradient.
  6. Set the foreground colour to white and the background colour to black (D then verify).
  7. Click and drag from the centre of the canvas to one of the corners. Release. The mask now has a white centre (the black vignette layer is hidden at the centre) and black edges (the black vignette layer is visible at the edges).
  8. Reduce the Vignette layer Opacity to 40–60% in the Layers panel to control the strength of the effect.
  9. To adjust: click the mask thumbnail and drag a new gradient, or paint on the mask to fine-tune.
  10. To intensify the centre fade: after the radial gradient, paint the centre area of the mask with a large soft white brush at 40% opacity.
Soft vignette (~40%)
Strong vignette (~80%)
Wide gentle fade
Why non-destructive matters here: Because the black fill is on its own layer with a mask, you can change the opacity, repaint the mask, or delete the layer entirely at any time - Even after saving and re-opening the XCF. No photo pixels are ever touched.