Let's take a look at some of things we can do with layer masks, beginning with this simple composite of a cheery-looking viewer and a bright blue sky.
Open the source images, the smiley face viewer and blue sky.
Using the Move tool (v) drag the smiley viewer on top of the clouds image. Hold Shift to register the two layers, i.e., so that one fits exactly on top of the other. Double-click the layer thumbnails to name the layers.
Figure 4.6. The source images (examples A and B) and the finished composition (example C).
Make a selection of the viewer using the Magnetic Lasso tool. Alternatively, if you're comfortable with using the Pen tool, make a pen path around the viewer and convert this to a selection by choosing Make Selection from the Paths palette menu. For a discussion of drawing pen paths see the section "Drawing with the Pen Tool" in Chapter 1, "Selections." Feathering selections is also discussed in Chapter 1.
Apply a feather radius for a better transition between the selection edge and the background; I applied a feather radius of 1 pixel.
Figure 4.7. The Layers palette showing the layer mask applied to the smiley layer.
Click the Add Layer Mask icon at the bottom of the Layers palette to reveal the selection and hide, or mask, the non-selected parts of the Smiley layer. This reveals the Clouds layer below. For the opposite effecthiding the selection and revealing the non-selected areasOption/Alt -click the Add layer mask icon.
Figure 4.8. Viewing the layer mask by itself: Option/Alt-click to toggle between the layer mask and the image.
Optionally, to view just the layer mask, Option/Alt-click the layer mask thumbnail. (Option/Alt-click again to return to the image). Viewing the layer mask thumbnail helps when refining the mask and for understanding how the layer mask is working.
Make your finishing touches. I couldn't resist: I moved and rotated the smiley. Because the layer mask is linked to the layer, the layer mask was moved and rotated along with it (see Figure 4.7). I applied some color correction using a Curves adjustment layer, changed the color of the viewer using a Hue/Saturation adjustment layer, and sharpened the Smiley layer with the Unsharp Mask Filter (Filter > Sharpen > Unsharp Mask). Adjustment layers are discussed in detail in Chapter 5, "Adjustment Layers."