Sunday, 14 June 2009

Background Masking Techniques in Photoshop part 1

The Magic Eraser Technique

Magic Eraser Technique_2

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.

Magic Eraser Technique_3

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.

Magic Eraser Technique_4

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!

Magic Eraser Technique_5

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:

Magic Eraser Technique_6

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.

Magic Eraser Technique_7

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

Magic Eraser Technique_8

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.

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!

Background Masking Techniques in Photoshop part 2

The Background Eraser Technique

Background Masking Techniques in Photoshop_9

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.

Background Masking Techniques in Photoshop_9a

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.

Background Masking Techniques in Photoshop_10

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.

Background Masking Techniques in Photoshop_11

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.

Background Masking Techniques in Photoshop_12

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

Background Masking Techniques in Photoshop_13

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.

Background Masking Techniques in Photoshop_14

Most of the background should be selected:

Background Masking Techniques in Photoshop_15

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

Background Masking Techniques in Photoshop_16

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.

Background Masking Techniques in Photoshop_17

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.

Background Masking Techniques in Photoshop_18

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.

Background Masking Techniques in Photoshop_19

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

Background Masking Techniques in Photoshop_21

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).

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.

Background Masking Techniques in Photoshop part 3

The Extract Technique

As with the Background Eraser technique, it's a smart idea to set the source for the History Brush early in the procedure, in case you need to do some touch-up later on.

Background Masking Techniques in Photoshop_22

Now, let's run the Filter > Extract command. (In earlier versions of Photoshop, this was located under the Image menu.)

Background Masking Techniques in Photoshop_23

The Extract dialog box will appear. With the Brush tool selected, draw an outline around the object you wish to extract. The outline should overlap both the object and the background. Use a Brush size that is big enough for you to outline comfortably, but small enough to outline any details of the picture. (You may switch Brush sizes while you're outlining.) The outline will be highlighted in the window.

Background Masking Techniques in Photoshop_24

If you need to zoom in while you're outlining, hold down the Space Bar to change the cursor temporarily to the "hand" icon. You can then click and drag to move around in the picture. Let go of the Space Bar when you're ready to go back to drawing.

When you've completed the outline, change to the Paint Bucket tool.

Background Masking Techniques in Photoshop_25

Fill the areas that you wish to "keep" with the paint bucket tool.

Background Masking Techniques in Photoshop_26

Click the Preview button to see how the object appears when extracted.

Background Masking Techniques in Photoshop_27

Here's what my preview looks like. It's good enough for my purposes, so I click "OK" to apply the Filter.

Background Masking Techniques in Photoshop_28

Again, I use the History Brush to restore parts of the object that were erased or partially erased.

Background Masking Techniques in Photoshop_29

And again, I use the Eraser Tool to get rid of stray pixels around the edges.

Background Masking Techniques in Photoshop_30

Here's the final picture (with drop-shadow applied):

Background Masking Techniques in Photoshop_31

Extract Filter Technique:

  1. Set source for the History Brush in the History Palette.
  2. Use Filter > Extract command to outline, fill, and Extract object.
  3. Use the History Brush to restore parts of object (1:45 minutes).
  4. Use the Eraser Tool to clean up the edges (1:30 minutes).

My take: This method, while a little faster, didn't seem much different from the Background Eraser technique. However, I have found that the Extract Filter works quite nicely when you have objects with a lot of fine details (like hair blowing in the wind, tree branches, etc.) that would be a pain to try to isolate. The Extract Filter works best with objects on solid-colored backgrounds.

Background Masking Techniques in Photoshop part 4

The Quick Mask Technique

If you've never used Quick Mask mode in Photoshop, you're missing out on a huge time-saver! Quick Mask mode lets you use brush, pencil, paint bucket, etc. tools to paint an "inverse selection" using shades of grey and black. (Black identifies parts that won't be selected; grey identifies parts that, when selected, will have some level of transparency.) When you switch back to Normal mode, the "clear" parts of your Quick Mask are selected so that you can apply changes. We'll use Quick Mask mode to paint the background of the image, then apply a Layer Mask to hide the background.

Click the Quick Mask icon in the tool palette to switch to Quick Mask mode.

Background Masking Techniques in Photoshop_32

Using a fairly large brush, with the foreground color set to black, I'll start to block out the background. You'll notice that the masked areas in which you paint will turn pink.

Background Masking Techniques in Photoshop_33

The large brush size allows me to color in the main areas of the background fairly quickly.

Background Masking Techniques in Photoshop_34

I can then use smaller brushes to fill in the details around the edges.

Background Masking Techniques in Photoshop_35

Eventually, I have the entire background colored in pink:

Background Masking Techniques in Photoshop_36

Tip: You may change the foreground color to white if you want to "paint back" parts of the object.

Switch back to Normal Mode, and you'll see the selection. Because everything that's painted in is not selected, the final result is that the bee is selected.

Background Masking Techniques in Photoshop_37

At this point, I click the Layer Mask icon at the bottom of the Layers Palette to create a layer mask, which essentially isolates the bee from the background.

Background Masking Techniques in Photoshop_38

So, here's the final picture:

Background Masking Techniques in Photoshop_39

And in summary:

Quick Mask Technique:

  1. Switch to Quick Mask mode and paint everything you want to get rid of.
  2. Switch back to normal mode and use the resultant selection to make a Layer Mask.

My take: A great method, because it gives you precision-control over what gets selected. This method works well for any picture -- solid background color or not. The only unfortunate aspect of this method is that, for some objects, you may see a "color halo" where the edges have picked up on some of the background color. (One way to get around this is to take a little more time and paint around the edges with a grey airbrush to make the edges a little transparent.)

Note: This same type of effect can be achieved by creating a Layer Mask, then painting on the layer mask with black paint to hide the background. The two techniques are virtually identical -- I just chose to write about Quick Mask because I've already covered the concept of Layer Masks in another article!

Background Masking Techniques in Photoshop part 5

Pen Tool Technique

My final technique will be to use the Pen Tool to create a path that outlines the object, then use the path to create a selection for a Layer Mask.

Choose the Pen Tool. In the horizontal options bar, make sure that "Paths," not "Shape layer," is selected. Then, start using the Pen Tool to create a path around the object. I find that it's helpful to zoom in for greater detail.

Background Masking Techniques in Photoshop_40

Here's my completely outlined bee. You can see all the different points that I created using the Pen Tool, as well as the resultant path.

Background Masking Techniques in Photoshop_41

Open the Paths palette and Ctrl-click (Command-click for Mac) on the path layer. This creates a selection from the path. In the diagram, you can see the dotted line that shows the selection.

Background Masking Techniques in Photoshop_42

If you have a pretty solid-shaped object, you can skip the next step. Because I have a fuzzy, plush object, I'm going to feather my selection slightly so that the edges will be a little blurred. I choose Select > Feather and make a Feather Radius of 1 pixel.

Background Masking Techniques in Photoshop_43

Finally, I click the Layer Mask icon in the Layers palette to create a layer mask from my selection. This hides the background and isolates the bee.

Background Masking Techniques in Photoshop_44

Here's the final picture:

Background Masking Techniques in Photoshop_45

In summary:

Pen Tool Technique:

  1. Use the Pen Tool (set to "Paths," not "Shape Layer") to create an outline of the object.
  2. Ctrl-click (Command-click for Mac) the path layer to make a selection.
  3. Use the selection to create a layer mask.

My take: This method works for any object, regardless of the background, and is also quite precise. It's reasonably fast if you're comfortable with using the Pen Tool; otherwise, this method might take a long time! This method is probably better for objects that have crisp, hard edges, and, similar to Quick Mask mode, you may have a slight color halo if the object has picked up some of the background colors.

So, there you have it: five different ways to isolate an object from a background! Here's a quick summary of the different methods and when I think they're best used.

  1. The Magic Eraser Technique
    Great for erasing backgrounds that are mostly all the same color that contrast with the object (set a high tolerance and use one click!), but may involve a bit of touch-up work at the end. No good for objects that are on multi-colored backgrounds.
  2. The Background Eraser Technique
    This technique would be great on a photo object that is already "isolated" but has a solid, contrasting background color. Even still, I might pass up this technique for the next method, as they're essentially the same and I think the Extract method goes a little faster.
  3. The Extract Filter Technique
    Works best for erasing mostly solid-colored, contrasting backgrounds. Photoshop also does a nice job of getting rid of the color halo problem – but you may have to do some additional touch-up work at the end.
  4. The Quick Mask Technique
    Almost the ideal solution: relatively quick, pixel-perfect control over edges, and works with any kind of background. Plus, by using a layer mask, you don't actually delete any part of the background. The only complaint I have with this method is that you may get a color halo.
  5. The Pen Tool Technique
    Fantastic technique for objects with hard edges, and it works with any kind of background. You can be as detailed as you want to get a perfect outline, and you can always go back and modify the path if you need to. Plus, you get lots of practice using the Pen Tool.

Photoshop’s Linear Burn

Photoshop’s Linear Burn blending mode results in an effect similar to Multiply Mode, where lighter areas in the blend layer allow the bottom layers to “show through,” but is a little different in that it actually darkens the bottom layer’s colors.

Sounds almost identical to the Color Burn description, except that instead of “increasing the contrast,” Linear Burn “decreases the brightness” and darkens the base layer(s). In fact, unless you have a completely white area on the blend layer, the base layer will always be darkened; using linear burn will always result in a darker picture.

For example, starting with this picture of a rose:

Linear Burn 1

Duplicating the layer and setting the top layer to Linear Burn results in an overall darker picture, although the darker areas are “more dark.”

Linear Burn 2

Now for the practical application. I’ll start with these two (cropped) images:

Linear Burn 3

Linear Burn 4

Putting the leaf layer on top, I set it to Linear Burn, and this is what I get:

Linear Burn 5

Contrast this to Multiply mode:

Linear Burn 6

The Linear Burn example is slightly darker—linear burn tends to give you more “blacks” than multiply mode would. Either effect is useful… for me, it just comes down to what “mood” I’m in that day!