Photoshop Compositing Secrets: Extracting Hair
If you want to get into Photoshop compositing, one of the first features you'll have to conquer is selections. If you've ever tried selecting people (especially people with wispy hair) from one background and placing them onto another background, you know that it can be a huge pain in the neck. But by using the Refine Edge feature and a few other tricks in Photoshop CS5, you'll start your composites out right—with a good selection. After that, making them fit into another background becomes a lot easier.
The following tutorial shows you step by step how to select a person with curves and troublesome hair (that is, troublesome for us—and maybe her stylist) so perfectly that we can blend her image indefinably into a different background.
Basic Hair Selection
- Go ahead and open a photo of someone who has wispy hair. In Figure 1, the example I'm using shows an image with some cleanly defined edges around the woman's clothing, but she definitely has some flyaway hair, too.
- Use the Quick Selection tool to put an overall selection around the person. Spend a minute or two to get the selection as close as possible around all of the well-defined edges, but don't worry about the hair yet. Just get the overall selection to be very close, as you see in Figure 2. Don't even try to select the hair edges at this point.
Refining the Edges
- When you're ready to start working on the person's hair, click the Refine Edge button in the options bar to open the Refine Edge dialog (see Figure 3a). Press F to cycle through the View settings to get to Black, since a black background shows off the light hair in this selection really well (see Figure 3b). If the person in your example has dark hair, try a white background instead.
- Turn on the Smart Radius checkbox and drag the radius slider to around 10, as shown in Figure 4a. You should immediately see a big improvement, as shown in Figure 4b. Seriously, folks, if you've ever doubted how powerful this Edge Detection stuff is, take a look at what it's doing here. Press the P key to see your original and then press P again to see your current selection. All we've done so far is move one slider, and our selection is already starting to pick up more hair!
Refining the Radius
- Okay, we still have some work to do. In my example, we can definitely see the gray background behind the model peeking through around the edges of her hair, especially near her shoulders. And the hair is still way jagged. This is where we call in the ringer. The big dog. The head honcho. (Okay, I'll stop.) The Big Kahuna here (sorry, last one) is the Refine Radius tool. It's the little brush icon (circled in Figure 5) just below the Zoom and Hand tools at top left in the dialog.
- Just like other brushes in Photoshop, the Refine Radius tool has a size setting that can be controlled with the left bracket ([) and right bracket (]) keys on your keyboard. Resize the brush to cover the entire radius of any flyaway hair; then simply start painting around the edges of the hair. As you paint, you'll reveal part of the original background, so you can see just how far out you'll have to paint to get all of the hair (see Figure 6a). When you release the mouse button, sit back in awe as Photoshop selects the hair but leaves out the background (see Figure 6b). Sometimes Photoshop needs a few seconds to catch up, so be patient when using this tool. I know, I sound like a total Refine Edge fanboy—but you have to admit that this tool rocks!
- Continue brushing around the edges of the hair to bring all of the wispy hair edges back (see Figure 7). You can paint in one long brush stroke around the entire head, or use smaller strokes in more concentrated areas. Honestly, I've tried both techniques, and I haven't noticed better (or worse) results from either method.
Ready to Mask?
- The selection is looking good now. Choose Layer Mask for the Output To setting, and click OK when you're done (see Figure 8a). Now we have her selected from the background, on her own layer, with a layer mask attached to it. Since there's already a mask there, you'll just see a transparent background behind your model (see Figure 8b).
- Open a background image where you want to place the copied image. For my model, Jessica, I'm using a background that has a lot of bright natural light in it, since Jessica has light on both sides of her hair, and I think a bright background fits her best. With your background image open, switch back to the original photo and select the Move tool from the toolbox (just press V). Drag the photo to the new background and position it where you want it—for this example, I'm placing Jessica's image (see Figure 9a) on the right side of the background (see Figure 9b).