Back to Tutorials

How to use layer masks and clipping masks

In image editing, masks nondestructively hide parts of layers. There are lots of different uses for masks and they are an incredibly flexible and powerful image editing tool. For example, in photo editing, you might use masks to combine parts of different photos into one. In graphic design, you might use clipping masks to fit an image within a container. And, in illustrations, you might use masks to fill layers with textures. Let’s check out how masks work and how to use them.

What do masks do?

Essentially, layer masks ‘erase’ parts of layers so they are no longer visible. Why not use the Erase tool for this? There are a few reasons — for one, once you erase an area, you need to go back and undo every change to get the original image back. It may also not be possible to erase certain layers such as text, shapes, or RAW layers. Masks let you nondestructively hide parts layers of every type — even layer groups. And you can remove or refine masks whenever you want in order to make the original image fully visible. Not just that, masks can also be copied from layer to layer and edited using effects, making them infinitely more versatile for many image editing tasks.

Layer masks

In Pixelmator Pro, there are two kinds of masks: layer masks and clipping masks. Let’s start with layer masks.

Add a layer mask

To add a layer mask, Control ?-click a layer in the Layers sidebar and choose Add Mask. You could also select the layer you’d like to mask and choose Format > Mask > Add Mask (from the Format menu at the top of your screen).

Notice how a white thumbnail appears next to the layer. Layer masks work in black and white (otherwise known as greyscale). The color white doesn’t hide anything, so a completely white mask will have no effect on the image. Any part of a mask that is pure black will completely hide those areas of a layer. By default, when you first add a layer mask, it’s completely white.

Edit your layer mask

To begin editing your mask, you’ll first need to click the thumbnail to select the mask.

You can use almost any tool in Pixelmator Pro to edit masks, just like you would edit any other type of layer. But to mask out photos, the Paint tool is often used, so let’s start with that.

Once you’ve added the mask, choose the Paint tool (by pressing the b key) and select a basic round brush. To make it easier to edit masks, you can reset the primary and secondary colors to black and white and to do that, you can press the d key. By default, the color black will be selected.

Useful Keyboard Shortcuts

When editing layer masks, there are three very useful keyboard shortcuts to remember:b, d, and x. The b key selects the Paint tool so you can choose a brush with which to edit the mask. The d key resets the primary and secondary colors in Pixelmator Pro to black and white. And the x key switches between those two colors.

With the layer mask still selected, paint over your image. The areas you paint over will be nondestructively hidden and, if you have other layers underneath, they will become visible. If you’d like, you can also experiment with shades of grey (or adjust the Opacity of your brush) to make areas partially visible.

Invert a Mask

You can use the Command ?i keyboard shortcut to invert a mask from black to white, so instead of painting to hide areas, you could start with a black mask and paint with white to gradually reveal areas.

After painting all the areas of the mask outside the balloon using a black brush, only the balloon is now visible. Everywhere else, the lower layer makes up the rest of the image. You can always edit your masks and temporarily disable them (or completely remove them) to make the entire original layer visible again.

In addition to manually painting masks, there are a few more ways to mask out parts of images. For example, you can create masks from selections. If you have an object you’d like to mask, you can first make a selection of it using any of the selection tools. When you add a mask, everything outside the selected area will be hidden by the mask, which is automatically created for you.

Mask Using Effects

You can even use effects to create masks nondestructively. For example, you can create a mask from an image by applying the Image fill effect to a layer mask. Or use the Gradient fill effect to create a fade effect.

Clipping Masks

Clipping masks, like layer masks, are also used to mask out parts of objects. However, instead of painting on a dedicated mask layer, existing layers in your Pixelmator Pro documents act as the mask — for example, you can use text and shape layers as clipping masks. When you create a clipping mask, any transparent areas of the clipping mask layer will mask out those same areas of any layers ‘clipped’ to it. In simpler terms, if you create a clipping mask from a circle and clip a photo to it, any parts of the photo outside the circle will be hidden.

Create a clipping mask

So, in order to create a clipping mask, you’ll need at least two layers — one layer to act as the mask, and another layer to be masked. Any layers at all will work, whether it’s some text, a shape, or even a layer group. The upper layer should be your content (an image, pattern, or texture) and the lower layer should be the object that acts as the mask.

In the screenshot above, we’ve added an ellipse shape and, by default, that appears above our image layer. First, move the ellipse layer below the image layer. Then, to create a clipping mask, Control ?-click the upper layer in the Layers sidebar and choose Create Clipping Mask. You can also select the upper layer and choose Format > Mask > Create Clipping Mask (from the Format menu at the top of your screen). There’s also a neat shortcut way for creating a clipping mask. Simply hold down the Option key and, in the Layers sidebar, click the area between any two layers.

Notice how the contents of the layer above are clipped to the shape of the layer below. You can choose the Move tool and resize both layers individually to change the mask or its contents. You can apply effects to either layer, too. And the great thing with clipping masks is that you can create them from any kind of layer. For example, if you add some text, you can clip an image to the text layer and edit the text whenever you want.

There are lots of different ways to use masks in image editing, but if you’d like to get a little bit more practice, try masking out the sky in one photo and replacing it with another or filling a text layer with an image using a clipping mask. And if you have any questions, feel free to post them below and we’ll do our best to help out!

Resources