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.
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:
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
- Select the target layer in the Layers panel (Windows → Dockable Dialogs → Layers if it is not open)
- Right-click the layer thumbnail or layer name
- Choose Add Layer Mask… from the context menu
- Select an initialisation option and click Add
Method 2: Via the Layer Menu
- Select the layer in the Layers panel
- Go to Layer → Mask → Add Layer Mask…
- Choose an initialisation option and click Add
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. |
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
- 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.
- Select the Paintbrush tool (P)
- Press D to reset foreground/background colours to black and white
- Press X to swap if you need white on top instead
- Paint over the areas you want to hide (black) or reveal (white)
- Use a soft brush (low hardness) for natural blended edges; use a hard brush for precise cuts
- 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.
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.
- Right-click the layer in the Layers panel
- Choose Apply Layer Mask, or go to Layer → Mask → Apply Layer Mask
- The mask thumbnail disappears; the hidden pixels are removed from the layer permanently
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.
- Use any selection tool to select the area you want to keep visible
- Optionally grow and feather: Select → Grow… by 1–2 px, then Select → Feather… by 2–4 px for softer edges
- Right-click the layer → Add Layer Mask…
- Choose Initialize to: Selection and click Add
- The selected area becomes white (visible) on the mask; everything else becomes black (hidden)
- Refine by painting white or black onto the mask with a soft brush
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.
- Click the mask thumbnail in the Layers panel to make it active
- Go to Colors → Invert (or press Shift+Ctrl+I on Linux/Windows, Shift+Cmd+I on macOS)
- 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.
- With your photo open, go to Layer → New Layer… and name it "Vignette". Set the fill to Black. Click OK.
- The canvas turns black. Drag the Vignette layer to the top of the layer stack.
- Right-click the Vignette layer → Add Layer Mask… → choose White (full opacity) and click Add.
- Click the mask thumbnail in the Layers panel to activate the mask.
- 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.
- Set the foreground colour to white and the background colour to black (D then verify).
- 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).
- Reduce the Vignette layer Opacity to 40–60% in the Layers panel to control the strength of the effect.
- To adjust: click the mask thumbnail and drag a new gradient, or paint on the mask to fine-tune.
- 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.