Non-destructive selective editing in GIMP with layer masks
Add a layer mask in GIMP, paint black to hide and white to reveal, and verify with PNG export. Learn how to keep the mask active, check results, and recover non-destructively.
17 May 2026, 05:55 UTC

You need to hide or reveal parts of a layer without erasing pixels. A layer mask in GIMP gives you that control. White reveals, black hides, and gray partially reveals. The original layer data stays intact, so you can change the mask later.
Desired outcome
Attach a grayscale mask to a layer, paint on the mask to selectively hide areas, and verify the result is non-destructive and exportable with transparency.
Prerequisites
- GIMP 2.10 or later installed. Mask behavior is stable across 2.10 and 3.0, though UI wording may differ slightly.
- An image open with a layer that contains the subject you want to edit.
- Familiarity with the Layers dialog. In GIMP a drawable is the thing you are editing. For a masked layer there are two drawables: the layer image and the mask.
Add a mask and initialize it
Open the Layers dialog via Windows > Dockable Dialogs > Layers.
- Right-click the target layer, for example a layer named
Subject, and choose Add Layer Mask. - In the dialog choose initialization. White (full opacity) is the safe default for selective hiding, because the layer is fully visible and you will paint black to hide.
- After creation the layer row shows two thumbnails: the layer image on the left and the mask on the right. The mask thumbnail is a small grayscale rectangle.
Risk: initializing with Black (full transparency) makes the layer invisible until you paint white. Choose the initialization that matches your workflow.
Paint on the mask, not the layer
The most common mistake is painting the layer image instead of the mask. GIMP indicates the active drawable by a white border around the thumbnail in the Layers dialog.
- Click the mask thumbnail so it is active. The border moves to the mask.
- Select the Paintbrush tool. Set foreground color to black to hide, white to reveal.
- Use a soft brush with moderate opacity for feathered edges. Painting black on the mask reduces visibility of the underlying layer pixels in that area. Painting white restores them.
Gray values give partial transparency. Opacity of the brush and the brush hardness affect the transition.
Expected checks
Confirm the mask is active
Before painting, verify the mask thumbnail has the white selection border. If the layer thumbnail is selected, strokes modify pixels permanently.
Toggle and inspect
- Right-click the mask thumbnail and choose Show Layer Mask to view the mask in isolation. This shows the grayscale values you painted.
- Toggle the mask visibility by clicking the eye icon on the mask column or by right-clicking and choosing Disable Layer Mask. Disabling the mask shows the layer fully, confirming the mask is the only thing changing visibility.
Export verification
Export to PNG to preserve transparency. JPEG flattens transparency and will bake the mask into the image. After export, open the PNG in an image viewer that shows alpha and confirm masked regions are transparent.
Limitation: GIMP 3.0 adds non-destructive layer effects, which are separate from layer masks. Do not confuse the two features.
Recovery options
Layer masks are non-destructive by design.
- Undo: press Ctrl+Z to revert the last brush stroke on the mask.
- Disable mask: right-click the mask thumbnail and choose Disable Layer Mask. The layer returns to full visibility without deleting the mask.
- Remove mask: right-click the mask thumbnail and choose Remove Layer Mask. This discards the mask permanently. Use only when you are sure.
- Reset mask: right-click the mask thumbnail and choose Add Layer Mask > White to start over, or fill the mask with white using Colors > Fill with FG Color.
If painting has no visible effect, check that the mask is active, the foreground color is correct, and the Paintbrush opacity is not zero.
Practical example
For a product photo on layer Product with a distracting background:
- Add Layer Mask initialized to White.
- Activate the mask thumbnail.
- Paint with a soft black brush at 80% opacity around the product edges to hide background.
- Toggle mask visibility to confirm the product remains intact when the mask is disabled.
- Export as PNG and verify transparency in the masked area.
The layer pixels are unchanged. You can later paint white on the mask to recover any area you hid.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.