credit goes to lunacore
Layer Masks are a very powerful part of Photoshop and that is for a couple of reasons:
- Layer Masks are editable selections that play an important role in non destructive editing
- Layer Masks offer flexibility because they can be almost completely treated as a full gray scale image, which allows the use of filters, selection tools, adjustment tools, etc.
- They have a visual strength, meaning that with a short look on the layers you can see how they affect the image
- They offer extra flexibility by being part of vector masks, layer sets, adjustment layers, etc.
- Layer masks allow you to save selections
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.
Masks explainedSo 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 (or hides the result of an adjustment layer)
Create a Layer Mask (all visible)
click 

Create a Layer Mask (all hidden)
alt + 

Use a brush to paint on the layer mask

Active Layer Mask
An active Layer Mask can be recognized by:
- a Layer Mask icon
Layer Mask 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)
An inactive Layer Mask can be recognized by:
- a brush icon
front of the layer (marked with red circle)
- a double border surrounding the layer in the layers palette (red arrow)
Unlinked Layer Mask
By default a layer and its masked are linked, meaning that moving the layer will also move the mask or moving the mask will also move the layer. We can unlink the layer and its mask by clicking on the link icon
. Both layer and mask can then be moved independently. The red ellipse shows where we have removed the link.

Disable a Layer Mask
You can disable a layer mask by holding down the shift key while clicking on the mask. The layer mask will then be marked with a large red cross.

Delete a Layer Mask
You can delete a layer mask by clicking on it and while holding down the mouse button dropping it on the trash
icon. A new window will opem with 3 options:
Apply: Apply the mask to the layer first, before removing it. Read more about this in the section "Apply Layer Mask’.
Cancel: Cancel this action
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)
You can right click on a mask and a context menu will pop up.
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
You can get rid of a masks by deleting it or by applying it to the layer.

This is the result of applying the layer mask to the layer:

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
A layer mask doesn’t need to be either black or white but it can be any gray scale image:

It’s easy to understand that white makes part of a layer visible and that black makes things invisible. Look at everything in between as changing the opacity of the layer. The opacity is the transparency of a layer.
In this example we have a gray mask and it has the same effect as changing the opacity, so the green looks lighter and that’s because part of the bottom layer (white) is shining through.
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 nice thing about layer masks is that they are flexible. In this example we have used a linear Black & White gradient to fill our mask:

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
You can add Layer Styles to any layer that contains a mask. The layer style will take the mask in account.
In this example the layer style wasn’t affecting only the layer, but the result of the layer and its mask (a green circle):

Vector Mask
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 dedicated Vector 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.
There are many way to create Vector Masks and these are just two examples.
Combine a Layer Mask with a Vector Mask
The great thing about Photoshop is that we can even combine a grayscale layer mask with a vector mask:

There is something about the above example that is important to know and that is that vector masks have a higher priority than layer masks. Look at this image:

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
the fill layer and the layer mask (you can move the mask independently of the layer by turning this off) and a link symbol
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
You can also add a mask to a layer set.
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
A clipping layer is nothing but a layer that is restricted by the layer beneath it. A layer can easily turned into a clipping layer by pressing Ctrl+G (command + G on the Mac) or Ctrl + Alt + G (command + option + G on the Mac) if you’re using Photoshop CS2. The clipping layer will only affect all non-transparent pixels. In this example the gradient only affected the circle:

Masks and filters
One of the best things of layer masks is that we can apply a effect to them.
In this example the effect distort / glass was applied:

Masks and adjustment layers
Masks can be used with adjustment layers. Have you ever added a new adjustment layer and did you notice a white square on the right of it in the layers palette; well, that’s a mask. By default Photoshop adds a white mask (all visible) to every new adjustment layer.
Look at this example:

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
One way to create a mask is by using a selection. In this example I’ve selected a paper box:

When we now click on the New Mask icon
, Photoshop will add a mask that is based on this selection:

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.
Shortcuts
