- #21 Making Color Range Selections
- #22 Using Layer Masks
- #23 Working with Multiple Layers
- #24 Adding Vector Artwork
- #25 Introducing Smart Objects
- #26 Repairing Image Flaws
- #27 Removing Color Casts
- #28 Using the Smart Sharpen Filter
- #29 Exploring Filter Combinations
- #30 Weighted Optimization for the Web
#22 Using Layer Masks
If you're making a selection to delete contents from a layer, consider converting the selection to a layer mask instead of permanently discarding it. A layer mask usually starts as a selection that is linked to a layer. The selection acts as a cutout or frame for which only part of the layer's contents show through. The effect is identical to deleting the contents of a layer, but layer masks afford you the freedom to change your mind since the underlying image remains intact. You can always go back and edit the mask.
It's easy to create a layer mask. Make a selection of what you would like to keep visible on a layer (except the Background layer). Click the Add Layer Mask button at the bottom of the Layers palette. Your selection is converted into a layer mask for the selected layer. Notice that a layer mask thumbnail is now linked to your layer thumbnail ( Figure 22a ).
Figure 22a After you create a layer mask on a selected layer, a mask thumbnail appears linked next to the layer thumbnail.
To view just the layer mask, Option/Alt-click the layer mask thumbnail. While in this mode you can edit the layer mask just like any other grayscale image. Areas you paint in white are visible, black are transparent, and anything gray translates into varying levels of transparency ( Figure 22b ). When you're through, click the layer thumbnail to see the effects of the layer mask. If you want to continue editing the layer mask while viewing its effect on the layer, just click the layer mask thumbnail (without the Option/Alt key). If you'd like to move the position of the mask independent of the layer, click the link icon between the layer and layer mask thumbnails. Temporarily toggle a layer mask on and off by Shift-clicking the layer mask thumbnail. To delete a layer mask, drag it to the Delete layer button on the Layers palette.
Figure 22b You can opt to view just the layer mask as you work on it, switch to the layer to see the effects of the mask, or temporarily disable the layer mask to see the layer's actual contents.
Layer masks are great when you want to use pixels to define your transparent areas, but if you want a hard-edged layer mask with the flexibility of using vector-based tools, you'll want to create a vector mask. You can make a vector mask by creating a work path outline using the Pen or Shape tools. Before you start creating your path, select the Pen or Shape tool and then click the Paths button in the options bar. After you've created your work path, hold down the Command key (Mac) or Control key (Windows) and click the Add Layer Mask button in the Layers palette. Vector masks work like layer masks, but they're easier to edit. You can even have a layer mask and a vector mask applied to the same layer ( Figure 22c ).
Figure 22c A layer can have a layer mask and a vector mask applied to it at the same time.