Sub topic 3
Creating a Layer Mask
This chapter assumes you can move around the Layers, Tools and Properties panels, use the Brush tool, and make basic selections with the Marquee, Lasso or Quick Selection tools. It also assumes you know that a mask's white areas show a layer, its black areas hide it, and its gray areas show it partially. Here you will learn the ways to add a mask to a layer, what each one produces, and the mistakes that cause trouble later.
What a layer mask is, structurally
A layer mask is a separate 8-bit grayscale image attached to a layer. It has the same pixel dimensions as the document canvas, unless the layer is smaller or larger and the mask is later transformed. Photoshop stores it as an extra channel. The layer's own pixels are never changed. This is why you can undo a mask edit days later by repainting it.
In the Layers panel, a layered mask appears as a second thumbnail to the right of the layer thumbnail. A small chain icon sits between the two thumbnails. A white outline around a thumbnail shows which of the two is currently targeted by your tools.
Method 1: The Add Layer Mask button
The fastest method uses the button at the bottom of the Layers panel. It is the rectangle with a circle in it.
- Select the layer in the Layers panel.
- Click the Add Layer Mask button.
The result depends on whether a selection is active.
| Situation when you click | Result | Mask content |
|---|---|---|
| No selection | Reveal All | Entirely white. Nothing is hidden. |
| An active selection | Reveal Selection | White inside the selection, black outside. |
With no selection, the new mask changes nothing visually. You must paint on it before you see an effect. This is the correct starting point when you plan to hide small areas.
Method 2: Hide All
To start with the layer fully hidden, hold Alt (Windows) or Option (macOS) while you click the Add Layer Mask button. The mask is filled with black, so the layer disappears entirely. You then paint white onto the mask to reveal only the parts you want.
With a selection active, the same modifier key gives you the inverse of Reveal Selection. This is called Hide Selection. The selected area becomes black and the rest stays white.
| Action | No selection | With selection |
|---|---|---|
| Click button | Reveal All (white) | Reveal Selection |
| Alt/Option-click button | Hide All (black) | Hide Selection |
Choose the starting fill by asking which area is smaller. If you need to hide a small part, start with white and paint black. If you need to show a small part, start with black and paint white.
Method 3: The Layer menu
The same options are available from the menu bar. Choose Layer > Layer Mask and then one of these:
- Reveal All: a white mask.
- Hide All: a black mask.
- From Transparency: a mask built from the layer's existing transparent pixels.
- Reveal Selection and Hide Selection: masks built from the active selection.
The menu is useful when the Layers panel is hidden or when you want to be explicit about the result. From Transparency is less well known. If the layer already has transparent regions, this option converts them into black areas of a mask and makes the layer pixels fully opaque. It is handy for layers that you earlier cut out by erasing.
Method 4: The Properties panel
When a layer has no mask, the Properties panel shows a Add a Pixel Mask button when the layer is selected. It creates a white pixel mask, the same as Reveal All. Once a mask exists, the same panel offers Density and Feather, which a later chapter covers.
If you click the Add a Vector Mask button instead, you create a vector mask, which is a different thing from a layer mask. Another chapter compares them. The two can coexist on one layer.
Worked example: blending a sky into a photo
Suppose you have a landscape photo on the Background layer and a second image of a dramatic sky on the layer above it. You want the sky to replace the original sky.
- Place the sky image above the landscape. Position it so the horizon lines roughly match.
- Select the sky layer. Do not make a selection.
- Click Add Layer Mask. The mask is white, so the sky covers the whole photo.
- Press D to reset the default colors, then press X if needed so that black is the foreground color.
- Choose the Brush tool with a soft round brush. Paint over the land area in the lower half of the image. The land from the photo shows through where you paint.
- If you hide too much, press X to swap to white and paint back.
Every stroke only changes the mask. The sky image is still complete underneath.
Which thumbnail is active
This is the most common source of confusion. After you add a mask, the mask thumbnail is selected, which you can tell by the white corner brackets around it. Your brush then paints on the mask. If you click the layer thumbnail, the brackets move, and the same brush paints color onto the layer pixels instead. That change is destructive.
Check the thumbnail before each stroke. Another quick sign is the document tab title. It reads something like Layer 1, Layer Mask/8, and it shows RGB/8 when you target the layer pixels.
Layers that cannot take a normal mask
Some layers behave differently when you add a mask.
- The Background layer is locked and has no transparency. The Add Layer Mask button is unavailable. To mask it, double-click the layer to convert it to a regular layer, or duplicate it with Ctrl+J (Cmd+J) and mask the copy.
- Fully locked layers (the padlock icon set to lock all) do not accept a new mask until you unlock them. Locking only transparent pixels or only position still allows it.
- Adjustment layers and fill layers already have a mask. Photoshop creates a white one for them automatically, so you paint on it directly.
- Groups accept a mask, and it hides or reveals the whole group content together.
- Smart Objects accept a mask on the layer. Their filters have a separate mask, which is covered in a later chapter.
Creating a mask from a selection
Making a selection first and then adding the mask is the most precise way to start. The mask takes its shape from the selection edge.
- Use any selection tool to select the area you want to keep. For example, use Quick Selection on a subject.
- Select the target layer.
- Click Add Layer Mask.
The inside of the selection stays visible and everything else is hidden. If you wanted the reverse, press Ctrl+Z and use Alt/Option-click, or invert the mask afterward with Ctrl+I (Cmd+I) while the mask is targeted.
Selection edges also carry through to the mask. A selection with a feathered edge produces a mask with a soft gradient edge. A selection with a hard edge produces a hard mask edge, which can look jagged on a subject with hair or fur. A later chapter covers refining those edges.
Common errors and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Add Layer Mask button is grayed out | The layer is the Background layer or is fully locked | Convert the Background layer, or unlock the layer |
| Brush paints color instead of hiding | The layer thumbnail is targeted | Click the mask thumbnail |
| Brush strokes do nothing visible | The foreground color is white on a white mask | Press **X** to swap colors, or make black the foreground |
| The whole layer disappeared | You created Hide All, or a selection was inverted | Paint white on the mask, or press **Ctrl+I** on the mask |
| The mask is the wrong shape after a move | The mask is unlinked from the layer | Check the chain icon, a later chapter covers linking |
| Painting shows a faint, patchy effect | Brush opacity or flow is below 100% | Check the options bar |
Checking the result without guessing
You can test a mask without painting anything. Hold Shift and click the mask thumbnail. A red X appears across it, and the mask is disabled. The layer shows in full. Shift-click again to enable it. This is a quick way to compare before and after.
To see the grayscale image itself, hold Alt (Option) and click the mask thumbnail. The canvas shows only the mask. Alt-click again to return. This is explored further in a chapter about viewing masks.
Choosing a method
- Use the plain button when you will paint away unwanted areas.
- Use Alt/Option-click when you will paint in only a small area.
- Use a selection first when the shape is already definable, such as a subject, a sky or a geometric region.
- Use From Transparency to turn earlier erased areas into editable mask areas.
Exercise
You have a portrait layer above a textured background. You want only the face to show, and you will paint it in by hand with a soft brush. Which method should you use to create the mask, and which color should you paint with?
Show answer
Alt/Option-click the Add Layer Mask button to create a Hide All (black) mask, because most of the layer must be hidden. Then paint with white on the mask to reveal the face. Before painting, confirm that the mask thumbnail has the white brackets.
Exercise
You make a selection around a subject and click Add Layer Mask. The subject disappears and the background stays. What happened, and how do you fix it without redoing the selection?
Show answer
The selection covered the area you wanted to hide, or you wanted the opposite of what Reveal Selection gives. Reveal Selection keeps only the inside visible, so the result should show the subject. If the opposite occurred, the selection was inverted. Click the mask thumbnail to target it and press Ctrl+I (Cmd+I) to invert it. The layer pixels are unchanged.