Using layer masks in Affinity Photo is a powerful way to combine parts of several images into a single image or to limit the effect of adjustment layers and filters to only affect part of your image. Layer masks are nondestructive. This means that you can modify them at any stage of your post-processing workflow.
What Are Layer Masks?
Layer masks allows you to control which part of an image layer should be visible and what should be hidden. You can add a layer mask to a layer or a group of layers. When added, the layer mask will either hide or reveal the layer below depending on the mask’s tonal value on a gray scale.
When you add a layer mask to a layer, a small thumbnail will appear to the right of the image layer’s thumbnail giving you a small preview of what the masks looks like.
A mask with pure white shows/reveals the layer. This also means that it hides anything on a lower layer.
A mask with pure black hides the layer the mask is added to. This means that the anything on a lower layer will become visible in the image.
If you give the layer mask a grey tone color it will partly show the layer and the layer below, just like the layers opacity slider would, except that you can control the layers opacity by using gray tone values. Now, this isn’t very useful yet. However, when you begin to create fine selections or draw with a brush tool on the layer masks you can control exactly which part of a layer should be visible and how it should blend with the below layer.
- White color in the layer mask shows the layer
- Black color hides the layer
- Gray color partly shows/hides the layer corresponding to its graytone value. The closer the graytone the masking color is to white, the more it shows the layer (and therefore the more it hides the below layer).
How To Add A Layer Mask In Affinity Photo?
Let us begin with a simple example in Affinity Photo. First, create a blank document/image file.
Next, create two layers. Make the top one green and the one below it red.
As you can see the red layer to completely covered by the green layer on top.
Now, let us add a mask to the green layer.
You can go about adding a layer mask in two different ways. You can either add a layer mask that shows or hides the entire layer or add a mask that takes the active selection into account and hides or shows the layer based on the selection.
Adding A Layer Mask That Hides Or Shows The Entire Layer
Make sure that you have no active selections in your image. You can do this by pressing CTRL+D (Win) / CMD+D (Mac) or by choosing Select > Deselect from the menu.
Next, select the layer you want to apply the mask to. In this case, select the green layer.
To create a mask that shows the entire layer, click on the Add Layer Mask button (insert image). You will find it at the bottom of the Layers panel.
If you instead want to hide the entire layer with the mask, you should hold down the Alt key (Win) / Option key (Mac) while clicking on the Add Layer Mask button. This will make the green layer invisible or hidden. The green layer is still there in the layers panel, but the masking layer thumbnail will be black indicating that the layer is hidden. Anyway, let us continue the example by starting with a white masking layer.
Using A Brush To Modify The Mask Layer
The next step is to click on the mask thumbnail and then use the brush tool on the image to modify the mask so it hides the parts of the layer you don’t want to be visible and shows the part you want to be visible. Again use a white brush to show the layer which has the mask and black to hide it. Since we are working on a completely white mask (making the layer visible), you can choose a black brush to reveal some of the red layer below. Remember to select the mask thumbnail to paint on the mask and not the image layer itself. When you use the black brush and paint on the mask, everywhere you use the brush will be hidden and reveal the red layer below.
For a more smooth transition, you can turn the opacity up and down or adjust the hardness of the brush.
Add A Layer Mask Based On A Selection
If you already know which part of the top layer you want to show and which to hide, you can take a shortcut and create a precise selection of the area and base the mask on this selection.
First, create the selection and then based on whether you want to hide the selected area or show this part of the layer, do the following:
- If you want to show the selected area on the active layer, click on the Add Mask Layer button at the bottom of the Layers Panel. This will add a mask layer, where the selected area is white and thus reveals the area, and the rest will be black and therefore hidden, making the layer below visible in this part of the image.
- If you want to hide the area you have made a selection of, you should press and hold the Alt key (Win) / Option key (Mac) while clicking on the Add Mask Layer button in the Layers panel. This will create a layer mask, where the selected area becomes black in the mask and thus makes this part of the layer transparent so you can see the layer below. The mask for the unselected part of the image becomes white and remains visible.
How To Enable Or Disable A Layer Mask?
After adding a layer mask, you might want to check how it has altered your image. To do this, the easiest way is to disable/enable the mask by shift-clicking on the layer mask thumbnail. This toggles the mask on and off. Alternatively, you could uncheck the checkbox in the right side of the masking layer. When the mask is disabled a red diagonal line is shown on top of the mask thumbnail and you will see the image without the masking effects.
How To Delete A Layer Mask?
If you regret adding a layer mask you can always delete it by selecting and dragging it to the trashcan button on the Layers panel. Remember to drag the mask thumbnail to the trashcan and not the image layer.
Displaying The Layer Mask Overlay
If you want to get a more detailed look at what your mask actually does, all you need to do is to hold down the Alt key (Win) / Option key (Mac) and click on the layer mask thumbnail. This will display a black and white representation of the mask on top of your image. This allows you to fine-tune the mask, even more, using the brush tool. To make the mask overlay disappear again, just click anywhere else in the layers panel to return to the normal view.
Working with masks in Affinity Photo is very useful for blending several bracketed shots together into a single image. This can be a complex and tedious editing process, which I will save for another article. In this tutorial, however, we will continue with looking at how you can use layer masks to limit the effect of adjustment layers and live filters to specific parts of an image.
Adjustment Layers and Masks in Affinity Photo
Adjustment layers have an inbuilt mask that is set to be completely white per default. This means that when you add an adjustment layer it will be applied to the whole image. You don’t have to add a new masking layer to your adjustment layers. You can modify this mask just as you would with a layer mask as explained above by using a brush or any of the selection tools.
Refining A Mask To Make It More Precise?
Now that you know how to create a mask and how it basically works, let us dig into how you can use a mask together with selections to change the background of an image.
As a case or sample image, we will use the above image of a leaf that I want to add some clarity to, without affecting the background. We can do this by using a Clarity Live filter with a mask. Remember this is just for the sake of improving this sample image. The principle behind refining a mask is the same for all adjustment layers, Live filters and creating normal layer masks to blend two images together.
First, create a selection of the leaf by using the magic wand selection tool or quick mask tool in Affinity Photo. Next, go to the Layers menu and choose Live Filters > Clarity filter. Because you already have an active selection when creating the clarity live filter Affinity Photo will automatically add a mask based on this selection. If you didn’t have an active selection, the mask would be all white, meaning that the whole image would be affected by the clarity filter.
If you take a closer look at what has been masked out, you will see that the mask might need a bit of extra work to become more precise. When working with complex images, like hair and fur, you will get a much better result if you take the time to refine the mask properly. Anyway, the good thing is that you can come back to refining the mask at any step in your editing process.
To refine the mask, right-click on the masking layer and select Refine Edge…
This will make the Refine Edge dialog appear.
In the Refine Edge dialog change the Preview mode to overlay, by clicking on the downward pointing arrow next to the dropdown where it says Overlay. This allows you to change how you view both the selection and the mask. You can view it as an overlay, black and white, a black matte (background), a white matte or a transparent matte. You might want to change the preview mode to get a better contrast between the object you are trying to mask and the background, as it will enable you to create a better and more precise mask if you can see what you are doing.
If you are not working on a photo with a super crisp edge like hair and fur, you might want to increase the feather slider to soften the selection edges. Feathering makes the transition softer. However when you work with crisp edges just keep it at 0px. If you increase the Smooth slider, the edge becomes softer and more smooth instead of jagged and zig-zagged.
Besides using the sliders to refine the edge, you can also paint over trouble areas to make Affinity Photo have a look at the area again and refine the selection. Just paint around the edge of the leaf where you want to refine the mask. Affinity Photo does a pretty good job at refining the edge selection. If you find that Affinity Photo selected too much, i.e. that the selection goes beyond an edge, just hold down the Alt (Win) / Option (Mac) key while painting over the trouble area. Work your way around the whole subject until you are happy with the result.
If you want to change the tolerance of the selection you can change pull the Border width slider a bit to the right. Experiment with this as it can give you a more precise selection.
The Ramp slider controls the offset of the selection. Pulling it to the left will contract the selection while pushing it to the right will expand your selection.
When you are happy with the mask, go to the Output section of the dialog and make sure that Output To is set to Mask. Next, click Apply to close the Refine Edge dialog.
When you learn to use masks in Affinity Photo you will find that it opens up a new world of possibilities for combining photos and adjustment layers in a very precise way that gives you much more control of the photo editing process.
Take your skills in Affinity Photo a step further and learn a professional and proven workflow, with the Affinity Photo Workflow Video Course.