GIMP Layer Masks: Blend Images Without Destroying Pixels
Use a GIMP layer mask instead of the eraser to hide parts of a layer, then verify the original pixels are intact and export the transparency correctly.
02 Jul 2026, 05:08 UTC

If you blend two images by erasing the top layer, the erased pixels are gone. Any later change — a different background, a shifted horizon, a client asking for more of the subject — means starting over. A layer mask avoids that: it stores the hide-or-reveal decision as a separate grayscale channel, so the layer's pixels stay exactly as they were and you can repaint the decision at any time.
This guide covers the mask workflow end to end: adding the mask, painting on it safely, proving the pixels are intact, and exporting the result. Version assumption: GIMP 2.10.x. GIMP 3.0 reworked parts of the interface, so if a menu path below does not match your build, look for the same command under the Layer > Mask submenu.
The outcome you are aiming for
Two layers stacked in one image, with the top layer partially hidden by a mask. The top layer still contains every original pixel; only the mask decides which of them reach the canvas. Later you can soften an edge, restore a region, or delete the mask entirely and get the untouched layer back.
Prerequisites
- An image with at least two layers: a background and the layer you want to blend. Open the Layers dialog with Windows > Dockable Dialogs > Layers (Ctrl+L) if it is not already visible.
- The layer you will mask needs an alpha channel if you ever plan to apply the mask. Layer > Transparency > Add Alpha Channel adds one; the menu entry is greyed out when it already exists.
- Save the working file as XCF before you start. Masks are stored in XCF; they are not stored in PNG or JPEG.
Step 1: Add the mask and choose the starting fill
Right-click the target layer in the Layers dialog and choose Add Layer Mask.... The dialog offers several starting states, and picking the wrong one is the most common source of confusion.
| Starting option | What the mask contains |
|---|---|
| White (full opacity) | All white; the layer stays fully visible |
| Black (full transparency) | All black; the layer is hidden until you paint white |
| Layer's Alpha Channel | The layer's existing transparency, converted to grayscale |
| Selection | White where the selection was, black elsewhere |
| Grayscale Copy of Layer | The layer's own brightness values |
| Invert Mask (checkbox) | Flips whichever source you selected |
For a typical blend, choose White (full opacity) and confirm. The layer looks unchanged, and a second thumbnail appears to the right of the layer thumbnail. That second thumbnail is the mask.
Step 2: Confirm you are editing the mask, not the pixels
Click the mask thumbnail once. In GIMP 2.10 the active element gets a highlighted border, and the status bar at the bottom of the image window identifies which one it is. If the layer thumbnail is active instead, every brush stroke changes pixels directly — the destructive behaviour you were trying to avoid.
With the mask active, press D to reset the foreground and background colours to black and white. Paint with black to hide the layer; press X to swap colours and paint with white to bring hidden areas back. Gray values produce partial transparency, which is what makes soft edges possible.
Step 3: Build smooth transitions with the gradient tool
Freehand brushing rarely produces a convincing horizon or vignette. Select the Gradient tool (G), set the gradient to FG to BG (black to white), and drag across the mask. The result is a smooth ramp from hidden to visible. Because you are drawing on the mask, you can repeat the drag as many times as you like without touching the image.
Two other mask sources are worth knowing: choosing Selection in the Add Layer Mask dialog converts an existing selection into a mask (white inside the selection), and Grayscale copy of layer builds the mask from the layer's own brightness, which suits sky replacement and similar luminance-based work.
Checks that prove nothing was destroyed
- Toggle the mask. Shift+click the mask thumbnail to disable and re-enable it. With the mask disabled, the full layer should reappear. If the shortcut does not respond in your build, use Layer > Mask > Disable Mask, which performs the same action.
- Inspect the mask itself. Layer > Mask > Show Mask displays the grayscale channel in the canvas, the fastest way to spot stray brush marks.
- Delete the mask. Layer > Mask > Delete Layer Mask removes the mask and restores the layer in full. If the original image comes back complete, your edit was non-destructive. Do this on a copy, or undo afterwards, if you want to keep the mask.
- Export a PNG. PNG carries an alpha channel, so the transparency your mask produced is preserved. JPEG has no alpha channel, so exporting to JPEG composites the layer against the background and bakes the soft edges in.
Recovery options
Masks are forgiving, but two actions are not. Layer > Mask > Apply Layer Mask bakes the mask into the layer's alpha channel; the mask is gone and the pixels have changed. Image > Flatten Image merges everything into one layer. Both are recoverable only through undo (Ctrl+Z) while the image stays open, so save an XCF beforehand.
If you have been painting on the layer instead of the mask, undo those strokes, click the mask thumbnail, and check the status bar before continuing. If the mask itself looks wrong, you do not have to delete it: fill it with white (with white as the active foreground colour, use Edit > Fill with Foreground Colour) and start again.
Limits and performance notes
Masks cost memory. A mask is a full-size grayscale channel, and a large soft brush over a high-resolution image keeps many tiles in memory at once. If painting becomes sluggish, raise the tile cache under Edit > Preferences > System Resources, or work at a lower zoom level.
Feathering is not a property of the mask dialog. The Layer Options expander inside Add Layer Mask controls the layer's opacity and blend mode, not the mask. To feather a mask, blur it with a filter, or feather a selection before creating the mask from that selection.
Finally, remember what a mask cannot do: it does not change colour, and it does not create pixels that were never in the layer. If a region is missing, the mask will only reveal whatever sits underneath.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.