Sunday, April 12, 2009

5 Great Background Masking Techniques in Photoshop

5 Great Background Masking Techniques in Photoshop

Isolate objects. Extract objects. Cut out an image. Remove a background. Call it what you will, each of these phrases describes the same objective: take a photo and isolate an object in it from the rest of the image, without the background.

Browse any major Web store and you'll see this kind of imagery used heavily within product catalogues. Go to any stock photo or image source, and you'll find "photo objects" of various household items set against a blank white background.

But, without guidance, trying to achieve this effect with your own photographs can be time-consuming and frustrating. You might try to use the lasso tool to outline the edges of the object (and then have to start all over when your mouse slips), or use the eraser brush to painstakingly wipe away pixels from the edges of the object. But a few attempts with these techniques result in crossed eyes and the beginnings of a migraine headache. There must be a better solution!

In this article, we'll explore five different methods to isolate objects in Photoshop. As you follow this tutorial, you'll gain a how-to explanation for each technique. You'll also get the stats on how long each method takes, and my opinions as to when each method is most appropriate.

The methods I'll demonstrate include:

  • Using Photoshop's Magic Eraser tool
  • Using Photoshop's Background Eraser tool
  • Using the Extract command
  • Using Quick Mask mode to make a selection and layer mask
  • Using the Pen Tool to make a selection and layer mask











I found a slightly wrinkled piece of white silky cloth and placed a stuffed animal on it. If you have control over the photography, a good rule of thumb is to try to provide a solid-colored background that contrasts with your object. (If I had a white object, I'd probably use a darker piece of cloth.) Of course, sometimes you just have to work with what you have. Don't worry, though: some of the techniques we'll discuss will work for any kind of photograph!

Do you have a photograph ready,and Photoshop open? Then, let's get started with the Magic Eraser technique…

Technique 1: The Magic Eraser Technique





The Magic Eraser tool (hold down the Eraser icon in the toolbar to access it) allows you to erase pixels that are all the same color (or are a similar color). If you used the Magic Eraser tool at its strictest setting, and clicked on a part of the picture that was orange, every other pixel in the picture of that exact shade of orange would be erased. We'll use the Magic Eraser tool to erase the whites and greys in this photo.

First, we'll change a few of the tool settings. By increasing the Tolerance, the Magic Eraser tool will erase "similar" colors as well (whites/greys). By checking the "Contiguous" box, the Eraser tool will only grab pixels of similar colors that are next to each other -- that way, I won't accidentally erase the whites of the bee's eyes.



My first pass is set to a Tolerance of 72. I click outside of the bee, in the "white" area. After only one click, Photoshop erases most of the background in the picture – not bad! If the Tolerance is too high, you might inadvertently grab some bits of the object as well. If that's the case, just Undo and try a slightly lower Tolerance level.













For my next few passes, I set the Tolerance to 32, and use the Magic Eraser tool a few more times in the grey "shadow" areas. In the diagram below, the left image shows the shadow before I used the Magic Eraser. The right image shows how a bit more of the shadow is erased with a single click of the Magic Eraser!












Unfortunately parts of the shadows are so dark that trying to use the Magic Eraser would end up erasing some of the black parts of the bee as well. So I stop using the Magic Eraser at about this point:













From this point on, I switch to the "normal" Eraser tool and set it to Brush mode. I zoom in and erase the shadow portions by hand. I also create a new layer underneath this one, and fill it with red (or any other contrasting color) so that I can see the "smudges" that were missed by the Magic Eraser. Then, I use the Eraser tool to wipe those out as well.









For the final touch, I add a drop shadow just to make the bee "pop out."












Here's the summary:

Magic Eraser Technique:

  1. First pass using Magic Eraser Tool: 72 tolerance, contiguous, anti-aliased.

  2. Second pass using Magic Eraser Tool: 32 tolerance, other settings same.

  3. Used Eraser tool (brush mode) to clean up edges, stray pixels, and shadow area.

Total time: 4:08 minutes

My take: This technique makes it easy to isolate objects that are on solid-colored backgrounds, although you may need to spend some time with touch-up. Beware of stray pixels and forget about using this technique if you have a multi-colored background!

Technique 2: The Background Eraser Technique





The Background Eraser Tool (again, hold down the Eraser tool to access this option) is meant to be used along the edges of an object. The center of the brush determines which similar colors to erase. The Background Eraser Tool will also change the edges of an object slightly so that you don't get a "color halo." We'll use the Background Eraser Tool to isolate and define the edges of the object, then erase the other pixels on the "outside."

Before you progress very far with this procedure, open the History Palette and, in the left column, click on the state to which you'd want to revert if you needed to "clean up" later on. If you're starting from scratch, this might be the only stage in the History Palette. In my case, I clicked on the state immediately before I started to use the Background Eraser (I got a little ahead of myself). We'll refer to the state you choose as the "source" for the History Brush.









The next step is to select the Background Eraser tool and choose a brush size that isn't too big, but will comfortably allow you to outline the image.




You'll see a round cursor with a crosshair in the center. The important thing is to keep the crosshair from touching the actual object (if it does, the object will be erased). So, as you draw along the outside of the object, keep the crosshair just outside the object. You'll see that the outside's "similar colors" start to be erased.








Continue around the entire object. You may notice that parts of the image get "eaten away." Don't worry – we'll use the History Brush later to bring those parts back.














Here's the bee after I outlined it completely with the Background Eraser Tool:















Now, let's get rid of the rest of the background. Select the Magic Wand tool, set the Tolerance to 100, check the Contiguous box, and then click on the background.











Most of the background should be selected:

















Go ahead and hit the Backspace key to delete the background. Use the Eraser tool to clean up any obvious stray pixels.















Now, select the History Brush tool. The History Brush allows you to paint over the image and "restore" the parts you paint to the "original state" that you selected in the History Palette.






Adjust the brush size of the History Brush as necessary for detail work. Then, start to clean up the inside edges of the object, being careful not to go outside those edges.










Finally, I use my red background trick again to catch some of the stray background pixels, then use the Eraser tool to get rid of them








My final image, with drop shadow applied, looks like this:















Here's the summary:

Background Eraser Technique:

  1. Set source for the History Brush in the History Palette.

  2. Used Background Eraser Tool to outline the edge (2 minutes).

  3. Used the History Brush Tool to touch up parts of the object that had been erased (1:30 minutes).

  4. Used the Eraser Tool to clean up the stray background pixels (2:23 minutes).

Total time: 5:53 minutes

My take: This is my least favorite of the techniques because I had to zoom in a lot and use the History Brush Tool and Eraser Tool extensively. This technique would have worked better with an object that had solid edges (as opposed to the fuzziness of a plush animal), as well as a more-solid background color. A situation in which this technique might work well would be one in which you had a photo object that was already "isolated" on a white background, and you wanted to use it as a floating object in a layered composition