Score a Knockout

Adobe Photoshop offers several methods for isolating an image with fuzzy, complex, or indefinable edges from its background. One of the most common techniques involves duplicating the color channel with the most contrast, applying several filters to the new alpha channel to further increase its contrast, and painting the border between foreground and background very carefully with a soft brush. This technique works for images with ultra-fine edge detail, but it can be extremely labor intensive and have you tearing out handfuls of your own hair while trying to paint individual hairs on the models head. There is a faster method that not only selects the ambiguous edges but automatically discards unwanted pixels, leaving the desired areas on an independent layer with much less effort.

The Extract command is actually a mini-program, complete with a sub-interface and its own set of tools. The Extract filter measures subtle differences of a defined edge by assessing its color and brightness and then determines how best to isolate the region. It literally “knocks out” the background, leaving the desired image with its fuzzy or ambiguous edges intact. You’ll find it in Photoshop’s Filter Menu.

Extracting is a four-step process. First, an outline is drawn around the edge to define the ambiguous area. Then, the interior of the outline is filled. Next, the extraction is previewed and edited for holidays, errors and artifacts. The preview can be refined as many times as necessary until all of the unwanted background is eliminated. Finally, the image is extracted, which deletes undefined areas and places the image on a layer surrounded by transparency.

In this example I’ll extract an image of a hairy gorilla from a grassy background to be used as a 96" x 60" banner for display at the entrance of a zoo. It’s always a good idea to duplicate the image (Image > Duplicate) prior to extracting it, because the extraction permanently eliminates pixels from the image.

Figure 1Figure 1 EDGE IT
After opening the dialog box (see Figure 1), the Edge Highlighter is selected. It’s at the top of the list of tools and looks like a wide magic marker. Specify the brush size in pixels, in the control panel to the right of the image, by dragging the slider or typing a value. The width of the brush defines the edge boundary and how much of the background will be preserved when the image is extracted. The wider the brush the less defined the edge will be.

Next, choose a color for the highlight, Green is the default, but Red and Blue are also on the list, as is Other, which, if chosen, displays the color picker. The choice of color will depend on the colors within the image. Choose a color that best reveals the edge when the highlight is drawn.

Figure 2Figure 2Manually drag the Highlighter around the edge of the area to be extracted so that it slightly overlaps both the foreground and background regions around the edge. If an area bleeds off the edge of the image, as in Figure 2, the bleeding edge should be left unhighlighted.

Erase mistakes with the Eraser tool. Drag over the colored boundary with it. Press Alt-Backspace (Win) or Option-Delete (Mac) to completely erase the highlight. To toggle between the Highlighter and the Eraser while drawing, press the Option or Alt key.

The Smart highlighting option will keep the highlight on the edge. It is intuitively attracted to the areas of most contrast and is especially useful when the edge between the foreground and background is sharp with similar color or texture.

If the image is especially intricate or lacks a clear interior, then the highlight should cover the entire edge. You can check the Force Foreground option for this purpose. Use this technique to extract areas that contain tones of a single color.

Figure 3Figure 3FILL IT
With the edge defined, fill the area with a color, as in Figure 3. It’s advisable to fill with a color other than the highlight color. Filling the interior of the highlighted edge determines what will be preserved and what will be discarded. To fill, choose the Paint Bucket and click inside the edge area.

Click Preview to view the extracted image. The edges should be soft and there may be unwanted pixels. The result of the extraction can better be seen if viewed using the following techniques: zoom in with the zoom tool to get a closer look; in the Show menu, switch between previews of the original and extracted images; and use the Display menu to preview the extracted image as a grayscale mask or against a white matte or a black matte.

Figure 4Figure 4To choose a colored background, choose Other and a color from the Color Picker. To display a transparent background, choose None, as in Figure 4. Select the Show Highlight or Show Fill option to display the object’s extraction boundaries or interior.

Figure 5Figure 5REFINE IT
Edge Pixels can be refined with the Cleanup tool (see Figure 5). Drag over the edge to eliminate excess pixels and erase it to transparency. Or press the Option/Alt key while dragging to restore opacity. Pressing a number key from 1-9 while dragging will vary the strength of the tool and how transparent or opaque the pixels that it touches will be.

The Eraser and Fill tools can also be used to edit the previewed image. The Eraser restores the edge to transparency. Clicking a filled area with the Paint Bucket removes the fill, which will eliminate the area when it’s finally extracted.

The Edge Touchup tool also edits the extraction boundaries. The tool, available when the extracted image is shown, sharpens the edges of the extracted image. It, too, has a cumulative effect as multiple passes are made over the edge. If there is no clear edge, the Edge Touchup tool can make the background more transparent.

To help remove stray artifacts in the extraction, click on the right arrow next to the Smooth field in the Extract dialog box. Enter a value in the field or drag the Smooth Slider. The higher the number, the greater the radius of pixels that will be affected.

When editing is complete, click Preview again to view the edited extraction. The extraction can be edited as many times as necessary until perfect results are achieved.
Figure 6Figure 6To apply the final extraction, click OK. All pixels on the layer outside the extracted image will be eliminated and replaced with transparency, as in Figure 6. It may be necessary to pass over a few areas with the Eraser tool to touch up any stray edge pixels and flawed areas that have been overlooked.

Figure 7Figure 7
The Extract command is an elegant and efficient feature for quickly and (somewhat) effortlessly removing a background. It lightens the difficult task of preserving fuzzy or ambiguous edges when compositing images to alternate or solid colored backgrounds. It is an essential asset for creating dynamic solid or gradient background supergraphics like the one in Figure 7.