Sub topic 4
Painting on a mask
Painting is the most direct way to shape a layer mask. You choose a brush, pick black, white or gray, and paint. Each stroke changes the mask and never touches the pixels of the layer. This chapter assumes you can create a layer mask (the previous chapter) and that you know the Brush tool basics: size, hardness and opacity.
What painting on a mask does
A layer mask is a grayscale image attached to a layer. White areas show the layer, black areas hide it, and grays show it partly. When you paint on the mask, you are painting values into that grayscale image.
- Painting with black hides the layer under the stroke.
- Painting with white reveals the layer under the stroke.
- Painting with a gray adds partial transparency. A darker gray hides more, and a lighter gray hides less.
Nothing is deleted. If you hide too much, paint white over the same spot and the pixels return exactly as they were.
Make sure the mask is active
The most common mistake is painting on the wrong thing. A layer with a mask shows two thumbnails in the Layers panel: the image thumbnail on the left and the mask thumbnail on the right. The one with a thin outline around its corners is the target of your brush.
- Click the mask thumbnail. A border appears around it.
- Check the document tab or the Properties panel. The Properties panel should show the "Layer Mask" heading.
- Look at your brush. With a mask active, the foreground and background swatches reset to black and white if you press
D.
If the image thumbnail is active, your brush paints color onto the layer pixels. That change is destructive. Press Ctrl+Z (Windows) or Cmd+Z (Mac) right away and click the mask thumbnail.
Black, white and the X key
When a mask is active, pressing D sets the foreground to white and the background to black. This is the reverse of the usual default for normal layers, because Photoshop uses the mask's own defaults. Check your swatches after pressing D, because the result depends on the mask state.
The key to remember is X. It swaps the foreground and background colors. A typical routine looks like this:
- Press
Dto reset the swatches to black and white. - Paint with black to hide an area.
- Press
Xto swap to white. - Paint over a mistake to bring the area back.
- Press
Xagain to return to black.
This switch between hide and reveal is how most mask work is done. You rarely need to select a different color.
Brush settings that matter
The same brush options you use on pixels apply to masks, but a few matter more here.
| Setting | Effect on a mask | Typical use |
|---|---|---|
| Size | Width of the stroke | Use `[` and `]` to change it quickly |
| Hardness | Edge softness of the stroke | 0% to 30% for blends, 80% to 100% for crisp edges |
| Opacity | How much gray each stroke can add | 20% to 50% for gradual build-up |
| Flow | How fast paint builds up while you hold the mouse | Lower values give smoother buildup |
| Smoothing | Steadies shaky strokes | Raise it for long, clean edges |
Opacity is the setting that produces gray. A black brush at 100% opacity makes pure black, which fully hides. The same brush at 30% makes a dark-gray stroke that hides only 30%. Painting again over the same area at 30% increases the effect, so you can build the mask up step by step.
Soft brushes versus hard brushes
A soft brush (low hardness) has a faded edge. It makes transitions that look natural, such as blending a sky into a landscape or fading a texture. A hard brush (high hardness) gives a sharp boundary. It suits objects with clean edges, such as a product on a white background.
A common approach is to use a hard brush for edges you can see clearly and a soft brush for the transition areas.
Worked example: blending two photos
Suppose you have a photo of a beach and a second photo of a dramatic sky. You want the sky to replace the dull one in the beach photo.
- Place the sky above the beach layer in the Layers panel.
- With the sky layer selected, click Add Layer Mask at the bottom of the Layers panel. A white mask appears, so the whole sky layer is visible and covers the beach.
- Click the mask thumbnail to make sure it is active.
- Choose the Brush tool and press
D, then check that black is the foreground color. - Set hardness to about 0% and opacity to 100%.
- Paint over the lower part of the sky layer where the beach should show through. The beach appears under the black strokes.
- Along the horizon, lower the opacity to about 30% and paint over the line a few times. Each pass hides a bit more of the sky, which makes the horizon blend.
- If the beach appears where it should not, press
Xto switch to white and paint those spots back.
The result is an image where you can still edit either photo, because both are fully intact.
Drawing straight lines and limiting your strokes
Some edges are straight, such as a horizon or a building wall. You do not need to draw them freehand.
- Click once at the start point, hold
Shift, and click at the end point. Photoshop paints a straight line between them. - Hold
Shiftwhile dragging to lock the stroke to horizontal or vertical. - Make a selection first. Painting on a mask only affects the area inside an active selection. This lets you use a hard-edged selection as a guide while the brush stays soft inside it.
Working with gray: building up and correcting
Painting at full black and white gives hard decisions. Gray gives you control. Here are practical habits.
- Use low opacity for anything that touches a natural edge, such as hair, fur or clouds.
- Press the number keys to change opacity quickly.
5sets 50%, and1sets 10%. Typing two numbers fast, such as3then5, gives 35%. - Alternate between black and white. If you overshoot, you can paint the other color at low opacity to ease back, rather than starting again.
- Zoom in. Edges that look fine at 25% often show a halo at 100%.
Painting with tools other than the brush
Any tool that paints or fills can edit a mask.
- Eraser: On a mask, the Eraser paints with the background color. It is easy to confuse, so most people stay with the Brush.
- Paint Bucket: Fills the mask with the foreground color. Useful for resetting a mask to all white or all black.
- Gradient tool: Makes smooth blends. The next chapters cover it.
- Dodge and Burn: These can lighten or darken the mask in a gentle way, but they are less predictable than a brush at low opacity.
You can also fill the whole mask from the keyboard. With the mask active, press Alt+Backspace (Windows) or Option+Delete (Mac) to fill with the foreground color. Ctrl+Backspace (Windows) or Cmd+Delete (Mac) fills with the background color.
Common errors and how to fix them
| Problem | Likely cause | Fix |
|---|---|---|
| Color appears on the image instead of hiding it | The image thumbnail was active | Undo, then click the mask thumbnail |
| The brush does nothing visible | Foreground color matches what is already there, or opacity is very low | Check the swatches and opacity |
| Strokes look blocky or have hard edges | Hardness is too high | Lower hardness |
| The reveal and hide seem reversed | Black and white are swapped | Press `X` and check the swatches |
| Paint only appears in part of the image | A selection is active | Choose **Select > Deselect** or press `Ctrl+D` / `Cmd+D` |
| A halo shows around an object | The edge was painted with a soft brush at a low zoom | Zoom in, repaint with a smaller, harder brush |
How painting fits the mask workflow
The flow of a typical painting session is below.
Summary of key habits
- Confirm the mask thumbnail is active before you paint.
- Use
Xto swap between hiding and revealing. - Use low opacity and soft brushes for blends, and hard brushes for clean edges.
- Use
Shiftfor straight lines. - Treat mistakes as free. White always brings the pixels back.
Exercise
You paint a black stroke on a layer mask and the stroke hides part of the layer. Later you decide the area should be visible again. What do you do, and why does it work?
Show answer
Press X to switch the foreground color to white and paint over the same area with the mask thumbnail active. It works because the mask only controls visibility. The layer's pixels were never deleted, so white on the mask makes them visible again exactly as they were.
Exercise
You want a gentle fade along a cloud edge, not a sharp cut. Which brush settings do you choose, and how do you build up the effect?
Show answer
Use a soft brush with low hardness (about 0% to 30%) and a low opacity (about 20% to 40%). Paint over the edge several times with black. Each pass adds more gray to the mask, so the layer fades out gradually. If you go too far, switch to white with X and paint back at low opacity.