Extracting objects from their background (Photoshop)
The Extract command provides a sophisticated way to isolate a foreground object and erase its background on a layer. Even objects with wispy, intricate, or undefinable edges may be clipped from their backgrounds with a minimum of manual work.
Note: For simpler cases, you can instead use the background eraser tool.
To extract an object, you use tools in the Extract dialog box. First you draw a highlight that marks the edges of the object, and define the object's interior. Then you can preview the extraction and redo it or touch up the result as needed. When you extract the object, Photoshop erases its background to transparency. Pixels on the edge of the object lose their color components derived from the background, so they can blend with a new background without producing a color halo.
You can add back opacity to the background and create other effects by using the Edit > Fade command after an extraction. (See Blending filter effects (Photoshop).)
To extract an object from its background:
- In the Layers palette, select the layer containing the object you want to extract. If you select a background layer, it becomes a normal layer after the extraction.
To avoid losing the original image information, duplicate the layer or make a snapshot of the original image state.
Note: If the layer contains a selection, the extraction erases the background only in the selected area.
- Choose Filter > Extract.
You use tools in the Extract dialog box to specify which part of the image to extract. You can resize the dialog box by dragging its lower right corner.
- Specify options for tools in the dialog box (you can change these settings at any time):
Adjust the view as needed:
- For Brush Size, enter a value, or drag the slider to specify the width of the edge highlighter, eraser, cleanup, and edge touchup tools.
- For Highlight, choose a preset color option, or choose Other to specify a custom color for the highlight.
- For Fill, choose a preset color option, or choose Other to specify a custom color for the area covered by the fill tool.
- If you are highlighting a well-defined edge, select Smart Highlighting. This option helps you keep the highlight on the edge, and applies a highlight that is just wide enough to cover the edge, regardless of the current brush size.
Define the edge of the object you want to extract:
- To magnify an area, select the zoom tool in the dialog box, and click in the preview image. To zoom out, hold down Alt (Windows) or Option (Mac OS) as you click.
- To view a different area, select the hand tool in the dialog box, and drag in the preview image.
- To draw a highlight that marks the edge, select the edge highlighter tool in the dialog box, and drag so that the highlight slightly overlaps both the foreground object and its background. Use Smart Highlighting to trace sharper edges. Use a large brush to cover wispy, intricate edges where the foreground blends into the background, such as hair or trees.
If you use Smart Highlighting to mark an object edge that is near another edge, decrease the brush size if conflicting edges pull the highlight off the object edge. If the object edge has a uniform color on one side and high-contrast edges on the other side, keep the object edge within the brush area but center the brush on the uniform color.
Define the foreground area:
- If the object has a well-defined interior, make sure that the highlight forms a complete enclosure. You do not need to highlight areas where the object touches the image boundaries. If the object lacks a clear interior, highlight the entire object.
- To base the highlight on a selection saved in an alpha channel, choose the alpha channel from the Channel menu. The alpha channel should be based on a selection of the edge boundary. If you modify a highlight based on a channel, the channel name in the menu changes to Custom.
- To erase the highlight, select the eraser tool in the dialog box, and drag over the highlight. To erase the entire highlight, press Alt+Backspace (Windows) or Option+Delete (Mac OS).
Click Preview to preview the extracted object, or skip to step 10 to extract the object without a preview.
- If the object has a well-defined interior, select the fill tool in the dialog box. Click inside the object to fill its interior. (Clicking a filled area with the fill tool removes the fill.)
- If the object is especially intricate or lacks a clear interior, make sure that the highlight covers the entire object, and then select Force Foreground. Select the eyedropper tool in the dialog box, and click inside the object to sample the foreground color, or click in the Color text box and use a color picker to select the foreground color. This technique works best with objects that contain tones of a single color.
Selected area highlighted and filled, and extracted object
Zoom in as needed, and set any preview options:
If necessary, repeat the extraction to improve the results (when you are finished, you can perform final touch-ups as described in step 9):
- Use Show menu options to switch between previews of the original and extracted images.
- Use Display menu options to preview the extracted object against a colored matte background or as a grayscale mask. To display a transparent background, choose None.
- Select Show Highlight or Show Fill to display the object's highlight or fill.
- To perform another extraction after adjusting the highlight and fill, repeat steps 5, 6, and 7.
- To perform another extraction with new extraction settings, change the Smooth, Force Foreground, or Color settings, and repeat step 7.
Note: To specify the amount of smoothing of the extracted object, drag the Smooth slider or enter a value. It is usually best to begin with a zero or small value to avoid unwanted blurring of details. If there are sharp artifacts in the extraction result, you can increase the Smooth value to help remove them in the next extraction.Touch up the extraction results as needed:
Click OK to apply the final extraction. On the layer, all pixels outside the extracted object are erased to transparency.
- To erase background traces in the extracted area, use the cleanup tool . The tool subtracts opacity and has a cumulative effect. You can also use the cleanup tool to fill gaps in the extracted object. Hold down Alt (Windows) or Option (Mac OS) while dragging to add back opacity.
- To edit the edge of the extracted object, use the edge touchup tool . The tool sharpens edges and has a cumulative effect. If there is no clear edge, the edge touchup tool adds opacity to the object or subtracts opacity from the background.
Note: For best results in cleaning up stray edges, use the cleanup and edge touchup tools in the Extract dialog box. You can also clean up after an extraction by using the background eraser and history brush tools in the toolbox.