The key to understanding selections, masks, and channels is to realize that deep down, they're all the same thing. No matter what kind of selection you makewhether you draw out a rectangular marquee, draw a path with the Lasso, or use the Magic Wand to select a colored areaPhotoshop internally sees the selection as a grayscale channel. If you've ever carefully painted around a window (the kind in the wall of your house), you've probably used masking tape to mask out the areas you didn't want to paint. If you apply the masking tape to the window, you can paint right over it, knowing that the window remains untouched. Selections, masks, and channels are electronic forms of masking tape.
In Photoshop, the masking tape is typically colored black. Let's say you use the marquee to select a square. Behind the scenes, Photoshop sees this square as a grayscale channel. In this selection channel, the areas that you selected (the parts with no masking tape over them) are white, and the unselected areas (the parts with masking tape over them) are black. As our friend and colleague Katrin Eismann likes to intone, "Black conceals, white reveals."
Photoshop offers three ways of interacting with this selection information, but the relationship between them isn't always obvious.
We'll show you how to bounce the information back and forth between these three states a little later in this chapter, but first, let's take a look at the information, and how it manifests itself in each of these three forms. Selections can be very simple or extremely complex, but no matter how simple or complex they may be, they share the same behaviors.
We'll start with a very simple example, a rectangular marquee (see Figure 7-4). The rectangular marquee is a very simple bi-level selectioneach pixel is either selected or unselected, and the channel that results when the selection is saved contains only black and white pixels. It works like real masking tapethe black pixels in the selection are the masking tape, protecting whatever's underneath, and the white pixels represent the area without masking tape, letting the paint (or the Curve, or Levels) pass through.
Figure 7-4. Selections, masks, and channels
Why Digital Tape Is Better
There's reality, and there's Photoshop. In real life, you can't have partially opaque masking tape. The wood or window or whatever is either covered and no paint touches it, or it's not (all the paint touches it). Fortunately, we're not dealing with real life; we're dealing with Photoshop, which is much more flexible than boring old reality.
Figure 7-4 shows a more complex selection, created by applying a 50-pixel feather to the original rectangular marquee. Internally, rather than creating a simple bi-level channel, the feathered selection creates a channel that contains intermediate grays as well as black and white. The gray pixels are partially selectedlighter grays are more selected than darker onesso any effect applied through the selection affects the fully selected pixels completely, affects the partially selected pixels in direct proportion to how selected they are, and doesn't affect the unselected pixels at all.
Figure 7-4. More complex selections, masks, and channels
The ability to partially select pixels is insanely useful in all sorts of situations, many of which we cover in Chapter 8, Making Selections. For the purposes of this chapter, we'll focus on the role of partially selected pixels in layer masks. Layer masks let you apply local, rather than global, correctionsthe mask lets you constrain the correction to the part of the image that needs it.
Unless you photograph outside the earth's atmosphere, you'll find that light never forms hard edges. There's always some transparency along edges, and the ability to create feathered (soft-edged) selections and masks is key to making localized corrections blend into the image in a way that seems natural.
Digital Tape Is Convenient
A second huge advantage of digital masking tape is that, unlike its real-world equivalent, you can easily copy it, move it, tweak it, or reuse it a year later. When you save a selection, you can recall it easily, and either reuse it as a selection, or apply it as a mask to a layer.
In fact, you can very easily bounce between selections, channels, and masks, which considering they're all the same thing, isn't surprising. The flexibility with which you can turn a selection into a channel or mask and vice versa is one of the major reasons why you should always get into the habit of saving any selection that's even slightly complex. A second reason is that if you fail to do so, you'll find that as soon as the selection becomes unavailable, you'll undoubtedly need it again!
Selections to channels
To turn a selection into a channel, you can use the slow method shown in Figure 7-3 and 7-4: choosing Save Selection from the Select menu and telling Photoshop where to save it. Alternately, you can use the much quicker method of clicking the "Save selection as channel" icon at the bottom of the Channels palette (see Figure 7-5).
Figure 7-5. Save selection as channel
Channels to selections
Photoshop offers three ways to load a channel as a selection. The slow waywhich we typically use only when we've saved a channel outside the document on which we're workingis to choose Load Selection from the Select menu, choose the channel from the ensuing dialog box, and click OK.
A slightly quicker method is to select the channel we want to load in the Channels palette and click the "Load channel as selection" icon at the bottom of the Channels palette. However, this method isn't ideal because we have to go back to the Channels palette to select the channel (usually the composite) on which we want to use the selection. So we almost always use the third method, which is to simply Command-click on the channel we want to load as a selection in the Channels palette. Figure 7-6 shows all three methods.
Figure 7-6. Load channel as selection
Selections to masks
Photoshop always adds a layer mask when you create an adjustment layer. Even better, if you have a selection active when you add an adjustment layer, that selection is automatically used as the layer mask. So the easiest way to load a selection as a layer mask for an adjustment layer is simply to activate it before creating the layer.
For layer types other than adjustment layers, you can load a selection as a layer mask by choosing Reveal Selection from the Layer Mask submenu (under the Layer menu). Or, if you want to reverse the layer mask, choose Hide Selection from same submenu. Even easier: Click the Add Layer Mask icon at the bottom of the Layers palette (see Figure 7-7).
Figure 7-7. Load selection as layer mask
Selections to existing masks
Sometimes, of course, we add an adjustment layer without remembering first to load the selection we want to use as a mask. In this case, the procedure is a little trickier.
If the selection is saved as an alpha channel (remember, you can substitute the phrase "saved selection"), you can copy it into the mask channel. The trick is that you must make the respective channels visible before copying and pasting, otherwise you'll wind up with a new layer instead of the mask you wanted (this still trips us up). Click the alpha channel's tile in the Channels palette to make it selected and visible, choose Select All (Command-A), then Copy (Command-C). Then click the Layer mask tile in the Channels palette, click the eyeball to make it visible, and paste (Command-V; see Figure 7-8).
Figure 7-8. Copy channel to Layer mask
Or, if the selection is active, you can use the following method instead. Target the mask channel either by clicking its thumbnail in the Layers palette or by clicking its tile in the Channels palette. Make sure that Black is the Background color (press D to set black and white as foreground and background, respectively, then press X to switch them), and hit Delete to fill the selection with black on the Layer mask. This gives you the opposite selection from the one you want. To fix it, deselect the current selection (press Command-D), then invert the layer mask by pressing Command-I. It's a little fiddly but it takes longer to explain than to accomplish.
Painting on the layer mask
Bruce has always felt that the process of first defining the area you want to change (by making a selection) and then changing it is fundamentally bass-ackwards. He much prefers to make the change, then apply it to the places that need it. With layer masks, he (and you) can do exactly that.
Typically, we make edits to a layer so that it affects the entire image (we ignore what's happening in the areas we don't want to change). Then, we'll edit the layer mask. Sometimes that means inverting the layer mask to turn it black, hiding the entire edit, and painting with white on the mask to reveal the edit where it's wanted. Sometimes it means painting with black to mask out the areas we want to leave unchangedwe'll use whichever method requires less brushwork. Quite often, we'll use a gradient fill to apply a graduated change across the image, and sometimes we'll even resort to using the selection tools! (Again, see Chapter 8, Making Selections, for more on selections and masking.)
So with all the aforementioned techniques under our belts, let's look at their application to actual images.