http://designorati.com

Removing Backgrounds, Part 3: The Magnetic Lasso Tool

By Jeremy Schultz On 17th November 2005 @ 22:06 In Photoshop, Tutorials | No Comments

The third installment of my four-part series sheds light on the peculiar, misunderstood Magnetic Lasso tool

The Magnetic Lasso

In the [1] first and [2] second installments of the Removing Backgrounds series, we studied the Background Eraser and Magic Eraser tools and saw how one edited pixels according to color, the other according to color and value. Now we are breaking into new territory with a study of the Magnetic Lasso tool, which was introduced to Photoshop in version 6 but as far as I can tell never really caught on with users because of its (allegedly) finicky nature and complex settings. But like the Background Eraser and Magic Eraser tools, the Magnetic Lasso tool was designed to tackle a particular problem and if you know when to use it and which settings are best it can be a valuable tool to have.

Look For Contrast

fig1
Figure 1: The Jeep Liberty.

Figure 1 shows how I got my start as a designer: cars. Yes, I was an entry-level graphic designer at a daily newspaper and a lot of my job was “cutting out” cars for the automotive ads I’d be building all the time. Before Photoshop 6 (I started with Photoshop 5.5) I used the Polygonal Lasso tool and draw a selection around the vehicle, then create a clipping path so Quark would know what to crop and what to keep. When Photoshop 6 was released the Magnetic Lasso tool was touted as a new feature and it was designed for this very thing, drawing selections around object by following the edges. But in my opinion the default settings for this tool made it seem unusable right out of the box, and most every designer I know tried it, cursed at it and went back to the Polygonal Lasso tool or whatever technique they used. It’s the settings that make the tool anything from worthless to, well, magnetic!

The Magnetic Lasso tool works by conforming to the nearest edge (defined by its contrast) of an object. Therefore, this tool works best when you have a foreground object with an edge that contrasts well with its background. A black vehicle with a white wall behind it would be a perfect candidate. A white goat on a white background would not (and we’ll get to that one later). So when you’re deciding how to remove a background from a particular photo, if the foreground object has a contrasting edge then you have a good shot with the Magnetic Lasso tool.

We’ll be working with the Jeep Liberty photo in this example, the edge contrasts pretty well around the whole vehicle. It’s not perfect though, especially with the vehicles, foliage and lightly-colored road in the background, and they’ll present a challenge as we work.

The Settings

fig2
Figure 2: The Magnetic Lasso tool’s options.

First, we must prepare our settings (the options are shown in Figure 2). A rundown:

  • The New/Add/Subtract/Intersect Selection buttons are standard with Photoshop’s selection tools and are self-explanatory. You’ll usually be working with the New Selection button activated, unless you are making two or more selection and combining them, removing one from another or intersecting them
  • The Feather setting allows you to feather your selection after creating it
  • The Anti-Alias checkbox will smooth the edge of your selection after creating it, in order to [3] eliminate any jagged edges created by a pixel-based selection

The rest of the settings are specific to the Magnetic Lasso tool and are at the heart of the tool’s success or failure:

  • The Width setting tells the tool how far away from its hotspot it should be looking for edges. A large Width setting may make the tool snap away from your hotspot and toward a point of high contrast within its width radius. Use a small Width setting if you are keeping your tool’s hotspot right where you want the edge to be detected, and larger if you are using the tool quickly and don’t feel you will keep the hotspot very close to the edge all the time.

Two great tips when working with the Magnetic Lasso tool and the Width setting:

  • Press Shift when using the Magnetic Lasso tool to see the Precise cursor, which will show the circular range the tool is using to search for edges.
  • Press the left or right bracket keys to enlarge or contract the tool’s width, even in the middle of using the tool. I am tweaking the tool’s width constantly as I use it, because even in the same image a large or small width may make things a lot easier.
  • The Edge Contrast setting specifies the contrast needed for the Magnetic Lasso tool to snap to it and treat it as an edge. The default value is 10%, which makes almost any sharp variation in value considered an “edge”, and this is why I think the tool never really caught on. At 10%, the tool will detect edges you don’t want! I keep my Edge Contrast setting around 40-50% and never change it.
  • The Frequency setting dictates how quickly points are added to the selection. As you draw the selection boundaries with the Magnetic Lasso tool, points are added to the line similar to points on a Pen tool’s Bezier path. They serve as anchors, and ensure the selection will not be snapping to other edges as you continue to lasso. The higher the Frequency setting, the faster points are added. This setting doesn’t affect how the Magnetic Lasso tool behaves as far as snapping to contrasting edges, but if you are having trouble getting the tool to go where you want to it sometimes helps to use a high Frequency setting so points are created more often and you can nail the selection down.
  • The Pen Pressure button is for use with pen tablets and can enable the Width setting to change with pen pressure.

Using The Lasso

Using the Magnetic Lasso tool is as easy as dragging the tool along the edge of the object you want to select. Depending on your Width setting, you can keep the hotspot near but not on the edge and the selection will snap to the edge. A small Width setting will require that you keep your hotspot practically on the edge or else it won’t factor into Photoshop’s judgment of just what “edge” you want the selection to snap to!

fig3
Figure 3: The selection is made.

Figure 3 shows my attempt to select the Jeep Liberty with the Magnetic Lasso tool. With a Width setting of 7 pixels (and changed when necessary), an Edge Contrast setting of 40% and a Frequency setting of 50, I was able to lasso the vehicle without many problems, though it wasn’t perfect. There are some hard edges in the rest of the image that the Magnetic Lasso tool just can’t resist snapping towards:

  • The shadow cast by the pickup draws the selection away from the Jeep’s hood
  • The Jeep’s own shadow draws the selection away from the front tire’s edge
  • The Jeep’s back and front windshield draw the selection away from the vehicle’s edge (because the vehicle is red and the grass green, it doesn’t read as a high-contrast edge)
  • The glare on the roof draws the selection away from the black tie-down bar on top of the Jeep’s roof

All of these problems are caused by high-contrast edges that lie too close to the low-contrast edges we actually want to use. There are a few ways to solve this:

  • Lower the Width setting and drag closer to the edge you want. The Magnetic Lasso tool can’t snap to another edge if it’s not in its range.
  • When you reach a problem spot, slow down, drag a little and click to insert a point and anchor your selection before the tool decides to snap somewhere else. The Magnetic Lasso tool can’t snap to another edge if you’ve locked it into place.
  • Ignore the tool’s mistakes and use other selection tools afterwards to add to or subtract from the Magnetic Lasso tool’s selection.
fig4
Figure 4: The background is removed.

Figure 4 shows the end result after I used Select->Inverse to select the background and hit the Delete key. In this case I just used the Polygonal Lasso tool to clean up the selection. I find that it can be easier than trying to find the perfect settings to make the Magnetic Lasso tool realize just what I want it to do. In some cases the edge is just too weak, or an edge nearby is too strong.

In the fourth and final installment of the series, to be published on Monday, November 21, we’ll look at Photoshop’s H-bomb for background extraction, the Extract filter. It’s been around since Photoshop 5.5 or 6 but it’s another one of those tools that is complex, tricky to use and trickier to use with spectacular results.

SERIES INDEX

[4] Part 1: The Background Eraser Tool
The Background Eraser tool removes backgrounds according to color, which makes it useful for images where the foreground object and background object have different color hues.

[5] Part 2: The Magic Eraser Tool
The Magic Eraser tool is a combination of the Eraser and Magic Wand tools, which makes it valuable in situations where backgrounds have a uniform color and value.

[6] Part 3: The Magnetic Lasso Tool
The Magnetic Lasso tool seeks edges with high contrast, making it a tool that can snap to a foreground object’s edges quickly in order to remove the background.

[7] Part 4: The Extract Filter
The Extract filter is a complex tool for eliminating the toughest backgrounds, including those dealing with hair, fur, leaves and blurred edges.


Article printed from Designorati: http://designorati.com

URL to article: http://designorati.com/articles/t1/photoshop/276/removing-backgrounds-part-3-the-magnetic-lasso-tool.php

URLs in this post:
[1] first: http://designorati.com/photoshop/2005/removing-backgrounds-part-1-the-background
-eraser-tool/

[2] second: http://designorati.com/photoshop/2005/removing-backgrounds-part-2-the-magic-eras
er-tool/

[3] eliminate any jagged edges: http://designorati.com/photoshop/tutorials-16/2005/tutorial-eliminating-jaggies/
[4] Part 1: The Background Eraser Tool: http://designorati.com/photoshop/2005/removing-backgrounds-part-1-the-background
-eraser-tool/

[5] Part 2: The Magic Eraser Tool: http://designorati.com/photoshop/2005/removing-backgrounds-part-2-the-magic-eras
er-tool/

[6] Part 3: The Magnetic Lasso Tool: http://designorati.com/photoshop/2005/removing-backgrounds-part-3-the-magnetic-l
asso-tool/

[7] Part 4: The Extract Filter: http://designorati.com/photoshop/2005/removing-backgrounds-part-4-the-extract-fi
lter/

Click here to print.