|Layer Masks are a very powerful part of Photoshop and that is for a couple of reasons:
Layer Masks are always saved when you save your document.
Layer Mask are quite often used to hide pixels, but can also be used to mask the result of an adjustment layer.
In this introduction we’re only going to focus on hiding pixels. later on we’ll see how layer masks can be used in combination with adjustment layers and layer sets.
So how do layer masks work? A layer mask is actually telling photoshop how to deal with the layer it’s attached to and does this by using shades of gray. Let’s focus for now only on black & white masks.To understand layer masks you have to remember the following:
- The color black in a layer mask hides the corresponding pixels in the linked layer (actually makes those pixels transparent).
- The color white leaves the corresponding in the linked layer intact; it doesn’t do anything with them
In our example we have two layers in our layers palette;
- A background layer that is green
- A layer named Layer 1 that is on top and is color yellow
We also notice a black & white image on the right side of our Layer 1; that’s the famous layer mask.
So what does that mean in our example? It means that the black ellipse is hiding the the corresponding pixels in the yellow layer (Layer 1).
What we see in our document window is always the result of looking down on the layers in the layers palette, starting at the top layer and in most cases ending with a background layer. All these are stacked on top of each other like playing-cards. Our yellow ‘card’ has a hole in it and that’s why it’s the only area where we can see the layer underneath, in our case the green layer. The result is a yellow square with in the middle a green ellipse.
So remember; black hides pixels (orhides the result of an adjustment layer)
This tutorial is split into several sections:
- Creating a Layer Mask (all visible)
- Creating a Layer Mask (all hidden)
- Using a brush to paint on the Layer Mask
- Active Layer Mask
- Inactive Layer Mask
- Unlinked Layer Mask
- Disabling a Layer Mask
- Deleting a Layer Mask
- Editing a Layer Mask in the document window
- Right click on Layer Mask (context menu)
- Apply Layer Mask
- Layer Mask with gray
- Layer Masks and gradients
- Layer Styles in combination with Layer Masks
- Vector Mask
- Combining a Layer Mask with a Vector Mask
- Combining Layer Masks
- Using clipping layers with Layer Masks
- Masks and filters
- Masks and adjustment layers
- Masks and selections
Create a Layer Mask (all visible)
This will create by default a white mask, meaning that no pixels of the layer will be affected; our document window will be filled with green:
Create a Layer Mask (all hidden)
Use a brush to paint on the layer mask
Active Layer Mask
- a Layer Mask icon in front of the layer (marked with red circle)
- a double border surrounding the Layer Mask (marked with red arrow)
Inactive Layer Mask (layer is active instead)
- a brush icon in front of the layer (marked with red circle)
- a double border surrounding the layer in the layers palette (red arrow)
Unlinked Layer Mask
Disable a Layer Mask
Discard: Remove the layer mask but keep the layer itself intact.
Edit a Layer Mask in the document window
We can edit the mask in the document windows by holding down the Alt key while double clicking on the mask.
Right click on Layer Mask (context menu)
Several options deal with a Selection. We’ll talk about this later.Earlier you’ve learned how to disable a mask, how to apply or discard it. You’ll notice that all these 3 options are available in the context menu.
The Layer Mask Options gives you the opportunity to change the color of the opacity mask. You’ll read more about that later.
Apply Layer Mask
We can apply a layer mask to a layer by:
- Clicking on apply when we want to delete a layer mask and getting the message “Apply mask to layer before removing?”
- Merging the layer with its mask with the layer underneath (Ctrl + E / Command + E on the Mac).
- Right clicking on the Layer Mask and selecting in the context menu ‘Apply Layer Mask’.
- In the menu: Layer / Remove Layer Mask / Apply
Layer Mask with gray
If the bottom layer would have been black, then the result would have been a darker green.
You can see what kind of effect gray scale masks have by enabling/disabling them a few times (see ‘Disabling a Layer Mask’)..
Layer Masks and gradients
The result is an image that’s green on top (white pixels in a mask don’t affect the layer), white at the bottom (black makes the green pixels invisible, so you can see the white background) and everything in between is a transparent green with the white background shining through.
Layer Styles in combination with Layer Masks
We’ve seen earlier that our regular masks are always grayscale. Photoshop however also allows us to use vectors to mask a layer. These vectors are not drawn on the normal grayscale masks but on a dedicatedVector Mask.
A Vector Mask can be created by going to the menu and selecting: Layer / Add Vector Masks / Reveal(hide) All
Now look at this example:
If we add a shape, in this case with the Ellipse Tool with the Shape Layers icon selected in the options bar, we’re actually creating a Fill Layer in combination with a Vector Mask.
Combine a Layer Mask with a Vector Mask
With the regular layer mask active and the vector mask disabled you’ll notice that the black line in the layer mask affects the complete layer. With the vector mask enabled and the layer mask disabled you’ll see a green circle.With both masks active you’ll see in the previous image that the layer mask is restricted to the vector mask; the black line only affects the green circle.
You’ll also notice that we now have a link symbol between the fill layer and the layer mask (you can move the mask independently of the layer by turning this off) and a link symbol between the layer mask and vector mask (you can move the vector mask independently of the layer by turning this off).
It’s important to know that the masks are linked to the layer and not each other, meaning that both masks can be moved independently of each other, even if all link symbols are visible.
Combine Layer Masks
This makes it for example possible to combine layer masks as shown in the next screenshot.
This layer set mask will also effect all layers that are inside nested layers.
Use clipping layers with Layer Masks
Masks and filters
Masks and adjustment layers
We have a background filled with a gradient and on top of that we have a box that has a layer mask attached to it. The layer mask has made the white background of the box layer invisible and that’s why we’re now looking at the background gradient of the background layer.
In the next example we’ve activated the Hue & Saturation adjustment layer that is clipped to the box layer(Ctrl+G ( Command + G on the Mac) or Ctrl + Alt + G ( Command + Option + G on the Mac) if you’re using Photoshop CS2), so that it will only affect that particular layer:
Notice how we used the Hue & Saturation adjustment layer to change the color of the box to blue. Its mask was disabled.
In the next example we’ve activated the mask that contains a linear gradient going from white (top) to black (bottom). Remember what I said earlier; lighter grays decrease the transparency, darker grays increase the transparency. The mask has used this to affect the result of the original Hue & Saturation adjustment layer.
Masks and selections
Important to know is that you can also invert a mask. In the next image I’ve selected the mask (notice the double border) and pressed Ctrl + i (Command + i on the Mac):
You can also invert an image using the menu: Image / Adjustments / Invert.
If we don’t change the mask after we’ve created it, then we can use this mask to return to our original selection. This is done by a Ctrl + left mouse click on the layer mask (Ctrl is command key on the Mac). The layer doesn’t need to be active for this.
Being able to convert a mask to a selection is a great advantage, because it allows us to save a selection without the need to save it in a channel. It’s also an advantage to see what is selected and masks allow us to do this.
If you have created a mask based on a selection and want to save this mask because you’re planning to make adjustments to it, then either save it as a channel or duplicate the layer and make it invisible.
There are many way to create Vector Masks and these are just two examples.