Color Plate 9-3.) Can you imagine selecting any one of them with the magnetic lasso or magic wand? No way. As demonstrated in Figure 9-33, these tools lack sufficient accuracy to do any good. The dress and background share too many colors for the background eraser to work. Meanwhile, you'd be fit for an asylum by the time you finished selecting the hairs with the pen tools, and the edges aren't definite enough for Select Color Range to latch onto.

Figure 9-33: She may look like a sweetheart, but this kid's elaborate details and indistinct transitions are too much for Photoshop's selection and extraction tools. This is a job for manual masking.
So, what's the solution? Manual masking. Although masking styles vary as widely as artistic styles, a few tried-and-true formulas work for just about everyone. First, you peruse the channels in an image to find the channel that lends itself best to a mask. You're looking for high degrees of contrast, especially around the edges. Next, you copy the channel and boost the level of contrast using Image Adjustments Levels. (Some folks prefer Image Adjustments Curves, but the Levels command is more straightforward.) Then you paint or edit the mask until you get it just the way you want it.The only way to get a feel for masking is to try it out for yourself. The following steps explain exactly how I masked this girl and pasted her against a different background. The final result is so realistic, you'd think she was born there.
STEPS: Masking a Monstrously Complicated Image
Browse the color channels. Press Ctrl+1 (z -1 on the Mac) to see the red channel, Ctrl+2 (z -2) for green, and Ctrl+3 (z -3) for blue. Note that this assumes you're working in an RGB image. You can also peruse CMYK and Lab images. If you're editing a grayscale image, you have only one channel, and that's Black, Jack.Figure 9-34 shows the three channels in my RGB image. Of the three, the green channel offers the most contrast between the hair, the dress, and the background. Hey, it ain't much, but it's better than nothing.

Figure 9-34: Of the three color channels, the green channel offers the best contrast between hair, dress, and background. Take my word for it.
Clone the channel. Drag the channel onto the little page icon at the bottom of the Channels palette to create a duplicate of the channel. Naturally, I clone the green channel. Now you can work on the channel without harming the image itself.
Choose Filter Other High Pass. The next thing you want to do is to force Photoshop to bring out the edges in the image so you don't have to hunt for them manually. And when you think edges, think filters. All of Photoshop's edge-detection prowess is packed into the Filter menu. Several edge-detection filters are available — Unsharp Mask, Find Edges, and many others that I discuss in Chapters 10 and 11. But the best filter for finding edges in a mask is Filter Other High Pass.High Pass selectively turns an image gray. High Pass may sound strange, but it's quite useful. The filter turns non-edges completely gray while leaving edges mostly intact, thus dividing edges and non-edges into different brightness camps, based on the Radius value in the High Pass dialog box. Unlike in most filters, a low Radius value produces a more pronounced effect than a high one, thus locating more edges.Figure 9-35 shows the cloned green channel on left with the result of the High Pass filter on right. I used a Radius of 10, which is a nice, moderate value. The lower you go, the more edges you find and the more work you make for yourself. A Radius of 3 is accurate, but it'll take you an hour to fill in the mask. Granted, 10 is less accurate, but if you value your time, it's more sensible.

Figure 9-35: After cloning the green channel (left), I applied the High Pass filter with a Radius value of 10 to highlight the edges in the image (right).
Choose Image Adjustments Levels or press Ctrl+L (z -L on the Mac). After adding all that gray to the image, follow it up by increasing the contrast. And the best command for enhancing contrast is Levels. I discuss this command in depth in Chapter 17. Here's the short version: Inside the Levels dialog box, raise the first Input Levels value to make the dark colors darker, and lower the third Input Levels value to make the light colors lighter. (For now you can ignore the middle value.)Figure 9-36 shows the result of raising the first Input Levels value to 110 and lowering the third value to 155. As you can see in the left-hand image, this gives me some excellent contrast between the white hairs and black background.

Figure 9-36: Here are the results of applying the Levels command to the mask after the High Pass step (left) and without High Pass (right). As you can see, High Pass has a positive effect on the edge detail.
To demonstrate the importance of the High Pass command in these steps, the right-hand image in Figure 9-36 shows what happened when I skipped Step 3. I applied the same Levels values as in the left image, and yet the image is overly dark and quite lacking in edges. Look at that wishy-washy hair. I'm sorry, it's simply unacceptable.
Identify the edges. By way of High Pass and Levels, Photoshop has presented you with a complex coloring book. From here on, it's a matter of coloring inside the lines. But you have to make sure your lines are coherent. In my case, the hair edges showed up as black lines against white, but the dress showed up as white lines against black. To keep things consistent, I selected the general region of the dress using the lasso tool and then chose Image Adjustments Invert (Ctrl+I under Windows, z -I on the Mac) to swap the blacks and whites. As shown in the first example in Figure 9-37, the image looks the worse for this change, but the outlines are easier to follow.

Figure 9-37: To ensure a consistent line between foreground and background, I selected the area around the dress with the lasso tool and inverted it (left). Then I selected the area inside the girl and filled it with black (right).
Use the lasso tool to remove the big stuff you don't need. To simplify things, get rid of the stuff you know you don't need. All you care about is the area where the girl meets her background — mostly around the hair and dress. Everything else goes to white or black.In the second example in Figure 9-37, I selected a general area inside the girl by Alt-clicking with the lasso tool (or Option-clicking on the Mac). Then I filled it with black by pressing Alt+Backspace (Option-Delete on the Mac).
In Figure 9-38, I selected the area outside the girl and filled it with white by pressing Ctrl+Backspace (z -Delete on the Mac). Notice I was able to accomplish a lot with the lasso tool, but not everything is as it should be. The areas inside the hair and around the right sleeve, in particular, require some careful attention with the brush tool.

Figure 9-38: By selecting the area outside the girl and filling it with white, I was able to clearly distinguish between foreground and background. But that still left a few messy edges, identified by the circles.
Incidentally, be sure to press Ctrl+D (z -D on the Mac) to eliminate the selection before continuing to the next step.
Paint inside the lines with the brush tool. This tends to be the most time-consuming part. Now you have to paint inside the lines to make the edge pixels black or white. For this image, I used the brush tool with a hard brush size of about 5 to 10 pixels. I used the X key to switch between painting with black and white. The first image in Figure 9-39 shows the fruits of my labors. As you can see, I made a few judgment calls and decided — sometimes arbitrarily — where the hair got so thick that background imagery wouldn't show through. You may even disagree with some of my brushstrokes. But you know what? It doesn't matter. Despite whatever flaws I may have introduced, my mask is more than accurate enough to select the girl, as I will soon demonstrate.

Figure 9-39: I fixed the problem areas by hand using the brush tool (left). Then I inverted the entire mask so the area inside the girl was white and the area outside was black (right). Depending on how you paint your mask, you may be able to skip this last step.
Invert the mask. You may or may not need to perform this step. Based on the condition of the edges after I chose the High Pass command, my girl ended up black against a white background. But I want to select the girl, so she needs to be white. Therefore, I pressed Ctrl+I (z -I on the Mac) to swap the blacks and whites. If your foreground image ends up white after Step 7, skip this step.
Switch to the color composite view. Press Ctrl+tilde (z -tilde on the Mac). Or if you're working in a grayscale image, press Ctrl+1 (z -1). By the way, now is a good time to save the image if you haven't already done so. Remember, TIFF is a terrific format for this purpose.
Ctrl-click (Win) or z -click (Mac) the mask channel to convert it to a selection. This mask is ready to go prime time.
Ctrl-drag (Win) or z -drag (Mac) the selection and drop it into a different image. Figure 9-40 shows the result of dropping the girl into a background of giant orange squash not unlike the one she holds in her arms. Thanks to my mask, she looks as natural in her new environment as she did in her previous one. In fact, an uninitiated viewer might have difficulty believing this isn't how she was originally photographed. But if you take a peek at Figure 9-33, you can confirm that Figure 9-40 is indeed an artificial composite. I painted in a few extra hairs to sell the composition, but that's because I'm an obsessive fussbudget. In most cases, you won't need to bother.

Figure 9-40: Thanks to masking, our girl has found a new life in a more sincere pumpkin patch. The prodigal daughter has returned.
The grayscale Color Plate 9-3, I set the brush tool to the Color mode. Then I Alt-clicked (or Option-clicked on the Mac) in the Background layer to lift colors from the new background and dragged to paint them into the hair. After a minute or two of this color painting, I arrived at the final composition in the color plate. Now if that isn't compositing perfection, well gee whiz, I don't know what is.