The Extract tool was mentioned in Chapter 7, "Using Selections, Paths, and Transforms in Photoshop." Although Extract is part of the Filter menu, it falls under the category of selections. In the Extract interface, you can separate the subject from its background, and it will be extracted onto a transparent layer for you.
When you select Filter, Extract or press Option--X (Mac users) or Alt+Ctrl+X (Windows users), you get the Extract dialog (see Figure 9.1). The basic operation of the Extract feature is fairly simple: Use the Highlight tool to trace the edge of the object you want to isolate and then click the Fill tool within the outline you just drew to fill the object with a mask. This indicates the area(s) you want to retain (see Figure 9.2).
Figure 9.1. The Extract dialog has a set of tools, the controls and settings for those tools, and a large preview window.
Figure 9.2. An outline is drawn around the object with the Highlight tool and then is filled with a mask using the Fill tool.
The Extract filter discards all the background pixels. If you want to keep a copy of the original, duplicate the layer and apply the extraction to the copied layer.
Next, either click Preview to preview the extraction or go ahead and click OK to begin the extraction process. You end up with the extracted object against a transparent background (see Figure 9.3).
Figure 9.3. The Extract filter strips away the background outside the masked area and leaves you with the extracted object against a transparent background.
You can alter the size of the Highlight tool by adjusting the Brush Size slider in the Tool Options portion of the Extract dialog. You can also choose a different highlight color if the default of lime green disturbs you (or, more importantly, if a similar color is used in the image and you can't see the highlighting).
A good option for many extractions is the Smart Highlighting check box. With this checked, you don't need to precisely draw a highlight around the edge of the object; the tool automatically seeks out the edge of the object and "snaps" to that edge. However, the effectiveness of the Smart Highlighting feature (as with the Magnetic Lasso selection tool) is a function of how distinct the edge of the foreground image is from the background. You may need to do some repair to the highlight after the fact (more about this in a moment).
Enlarge the brush size to cover intricate areas of the object, such as fine hairs, or other parts of the image that are not easily separated from the background. If you are unable to draw a definable border that can be filled (for example, it's hard to draw a highlight around a wispy strand of hair or a blade of grass), highlight all of what you want to include and then check the Force Foreground check box. Select the Eyedropper tool and select the color in the highlighted area that you want the Extract filter to base the extraction on. Naturally, this process works best on objects that have large areas of a single color, such as a blade of grass.
If you make a mistake while drawing with the Highlight tool, unlike with the Magnetic Lasso tool (or any other lasso tool), you can stop, switch to the Erase tool, erase the errant line, reselect the Highlight tool, and soldier on.
If you do stop and start with the Highlight tool and Erase tool, make sure that there are no tiny gaps in the finished, highlighted border; otherwise, the Fill tool will not place a mask within that border, but rather over the entire image. Use the Zoom tool to enlarge the highlighting and inspect it for small gaps. Use the Erase and Highlight tools to fix the border as necessary.
If your highlight is completely out of whack, hold down the Option key (Mac users) or the Alt key (Windows users). The Cancel button changes to a Reset button. Click it, and whatever highlight or fill you've drawn is erased, and you can start over without having to exit the dialog.
Unless you are using a stylus on a drawing tablet (such as Wacom's), you may need to go back over your border and fix any erratic portions of it. After all, a mouse is not a precision drawing tool. Also, this process may not be terribly effective if you've consumed a lot of coffee!
Previewing and Editing Extractions
After you have drawn a highlight around an object and filled it with a mask, click the Preview button to see a preview of what the extracted object will look like. If the edges are not clean, you can select either the Cleanup tool or the Edge Touchup tool.
Clicking and dragging with the Cleanup tool lets you erase portions of the mask, if there is still some background peeking through, either along the edge of the object or in the middle of the object. This is also good for adding "punch-through" parts of an image, such as transparent windows if you are removing a car from a background, for example. You can hold down the Option key (Mac users) or the Alt key (Windows users) while clicking and dragging the Cleanup tool to restore the mask, in case you erased too much (see Figure 9.4).
Figure 9.4. In Preview mode, the Cleanup tool lets you erase any portions of the background that got picked up by the mask.
The Edge Touchup tool lets you sharpen the edges of the object. Holding down the key (Mac users) or the Ctrl key (Windows users) while clicking and dragging lets you move an edge in or out, if the extraction process "missed."
If you like what you have created, click OK. Photoshop goes ahead and applies the Extract filter.
After you extract an object from an image, you can use any of Photoshop's other retouching tools and filters to make any further corrections or tweaks.
You can, of course, drag the extracted object to a new document to composite it on a new background (see Figure 9.5).
Figure 9.5. An extracted object can be composited over a new background without exhibiting any fringing around its edges.