- Mar 10, 2006
Lasso Like a Cowboy
No one makes a perfect selection with the Lasso tool the first time. First, make an initial selection that's close enough for you to fine-tune. You can then make additional passes to refine the selection until it's just right. As is so often the case, the secret lies within modifier keys you can press to change the behavior of the lasso tool as you draw:
- To add to an existing selection, start with the mouse button up and then Shift-drag the Lasso tool through the existing selection (
Figure 3.12 To add to an existing selection, Shift-drag the Lasso tool.
- To subtract from an existing selection, start with the mouse button up and then Option/Alt drag through the existing selection.
- When you Option-Shift-drag/Alt-Shift-drag a selection tool through an existing selection, what's left is the intersection between the two selections.
You can use these techniques with any tool that creates a marquee (that "marching ants" effect), such as the Magic Wand, Magnetic Lasso, or Elliptical Marquee tools. As you memorize the modifier keys, you can get into a rhythm where you "sculpt" rough initial selections into precise selections over multiple passes.
Selecting with the Magnetic Lasso
The Magnetic Lasso tool can be a godsend when an edge is so complicated that dragging the Lasso tool along it would be extremely tedious. As you move the Magnetic Lasso tool ( Figure 3.13 ), it looks for contours in the form of contrasty edges, and it creates a selection along the contour it finds.
Figure 3.13 The Magnetic Lasso tool automatically follows an edge formed by obvious contrast between colors or tones.
You don't need to constantly press the mouse button as you use the Magnetic Lasso tool. After you first click the tool to set the starting point of the selection, you can let go of the mouse button and simply move the pointer along the contour you want the magnetic lasso to follow, and the magnetic lasso can usually follow it. If it goes off course, you can then back up and drag, or back up and click to put down a control point.
Selecting by Color or Tone
If you want to select all areas of a color and the color appears in many separated areas throughout the image, the Color Range tool is probably a more efficient way. The Color Range command lets you click the color you want, and provides a Tolerance value so you can interactively include or exclude a range of variations in your target color. Unlike the Magic Wand tool, the Color Range command always selects all instances of your target color. Even though the feature is called Color Range, you can also use it to select a particular tone in a black-and-white image. To use the Color Range command:
- Choose Select > Color Range.
- In the Color Range dialog box (
), set the color or tone to select by choosing it from the Select popup menu, or clicking the color in the image window.
Figure 3.14 The Color Range dialog box after clicking the flower color to mark it for selection. The white areas will be selected.
- If you want to select more or fewer pixels based on their similarity to the color you clicked, drag the Fuzziness slider.
- To add or subtract colors from the selection, use the eyedroppers with the plus or minus sign, respectively, to click colors in the image.
- Click OK.
Selecting by Threshold
Not exactly. Color Range can select a range starting from any color or tone in the image, and provides ways to customize the selection. Threshold only lets you select a range of tones starting from black or white. Also, you can't go straight from the Threshold dialog box to a selection; after you isolate the area you need to click it with the Magic Wand tool.
However, when you quickly want to select a range based on the very lightest or darkest tones in the image, Threshold is a fast way to get it done ( Figure 3.15 ). Follow these steps:
- Choose Layer > New Adjustment Layer > Threshold and click OK.
- Drag the slider until you see the edge you want to define, and click OK.
- Select the Magic Wand tool, and click either the white or black area.
- In the Layers palette, click the eye icon for the Threshold adjustment layer to hide it, and select the layer where you want to apply the selection. The selection marquee now applies to the selected layer. (If you don't need the Threshold layer any further, you can delete it.)
Figure 3.15 The overcast sky in the original photo (top) is nearly all white, making it a good candidate for isolation with the Threshold dialog box (center). Once the desired range is isolated, you can select it by clicking with the Magic Wand tool (bottom).
Selecting from a Channel
An object with a dominant color has more color contrast in some color channels than in others. For example, if you have an RGB image of a landscape with a blue sky and you use the Channels palette in Photoshop to look at each channel individually, the sky stands out very clearly in the blue channel. This is similar to how Color Range works: If you want to select an area already isolated in one color channel, you can save a lot of time and effort by using that channel as a starting point for selection.
Keep in mind that image channels look different when you convert the image to different color modes. If the RGB channels of an image don't reveal any selection shortcuts, try duplicating the image and converting it to CMYK or LAB before checking the channels. If you're isolating an area defined by light and dark, you may find a selection shortcut in the K channel of a CMYK version of an image, or in the L channel of a LAB version of an image. To make a selection from a channel:
- In the Channels palette, click each of the different channels to see which one isolates your subject the best (
Figure 3.16 In this RGB image (far left), the flower's outline stands out clearly in the red channel (second from left). It's easy to make a clean selection from the red channel, though not from the green or blue channels (last two top images). At left is the Channels palette with the Red channel selected.
- In the Channels palette, Command/Ctrl-click the channel you picked in step 1. The channel is now a selection.
- If the subject or its edges need a little more isolation (it almost certainly will), you can use any other selection tools or Quick Mask mode to refine the selection into exactly the form you want. We discuss how and why to use Quick Mask mode in "Edit a Selection as a Quick Mask," later on in the chapter.
- To save what you've done as a new channel (so you can recall it again later), click on the Save Selection as Channel button in the Channels palette.
Remove a Difficult Background
You're nowhere near out of options! When you try to select along a very complex edge like hair, where contrast isn't consistent, selecting the edge you want may still be a challenge even with an intelligent selection tool like the Magnetic Lasso tool. The Extract feature is a way of indicating an edge through painting instead of drawing. Like other methods, it's not a cure-all, but when you need it, you need it. To use Extract:
- In the Layers palette, drag the layer you're working with to the New Layer button to duplicate it, then click the eye icon for the original layer to hide it. This step backs up the original layer data in case you want to try again.
- Choose Filter > Extract.
- Select the Edge Highlighter tool, and drag it to paint an outline along the edge you want to define (
). When dragging the brush, keep it over the edge you want to define. It's better to keep the brush center on the subject's side of the edge.
Figure 3.17 Working in the Extract dialog box: After dragging the Edge Highlighter tool (top), after clicking with the Fill tool (center), and after clicking the Preview button (bottom).
- When you're done painting the outline, select the Fill tool and click inside the area you want to keep.
- Click Preview to check the separation of foreground from background.
- If needed, use the Cleanup tool to make unwanted areas transparent, or use the Edge Touchup tool to define the edge of the subject more cleanly.
- When you're done, click OK.
One of the interesting things about the Extract feature is that it actually performs "edge-spill decontamination." That is, it gets rid of those ugly halos around the selection by removing the background color from the remaining edge pixels. Cool!
Edit a Selection as a Quick Mask
You accidentally put Photoshop into Quick Mask mode. This is not a bad thing. Quick Mask mode simply displays your selection as a channel instead of as a selection marquee ( Figure 3.18 ). Anywhere you paint in the Quick Mask becomes a selection when you exit Quick Mask mode. Use Quick Mask mode whenever you think it would be easier to define a selection through painting black and white rather than by using a selection tool.
Figure 3.18 When the Quick Mask button is active (left), a selection (center) appears as red pixels (right) so that you can use painting tools to edit the selection.
Now back to the main question: How did you accidentally get into Quick Mask mode? Normally, you'd enter or exit Quick Mask mode using the Standard Mode and Quick Mask Mode icons in the toolbox. You probably pressed the keyboard shortcut for Quick Mask mode, which is Q. If your selection goes Quick Mask red all of a sudden, all you need to do is press Q again (or click the Standard Mode icon in the toolbox). Or, you can edit your selection in Quick Mask mode before returning to Standard mode.
You can use selection tools to help you paint or erase in Quick Mask mode, but don't let that confuse you. The only areas that convert back into a selection when you leave Quick Mask mode are the areas that are colored when you're in Quick Mask mode.
If you don't like the red color, you can change it by double-clicking either the Standard Mode or Quick Mask Mode icon in the toolbox.
Convert between Mask, Selections, and Channels
You can save the Quick Mask selection as an extra "alpha" channel. In the Channels palette, click the Save Selection as Channel button ( Figure 3.19 )—or Option/Alt-click the button if you want to name the channel right away. A new channel based on the selection appears in the Channels palette. (Note that while you work in Quick Mask mode, a temporary Quick Mask channel appears in the Channels palette.)
Figure 3.19 Click the Save Selection as Channel button to convert the current selection to a new channel.
Once you save a selection as a channel, you can convert the channel back to a selection by Command/Ctrl-clicking the channel name in the Channels palette.
When you select your new channel in the Channels palette, you see the contents of the channel. You can edit a channel much like you would a Quick Mask—with painting tools. If you want to see the channel and the main image at the same time, enable the eye icons for both the channel and the main image in the left column of the Channels palette.
Convert between Selections and Layer Masks
Yes, by converting a selection to a layer mask. It's quite common to create a selection and then turn that into a layer mask. If you can create a selection that defines the outline of a subject, you'll be able to separate it from its background rather quickly.
- Create a selection (
Figure 3.20 The Layers palette (left) contains two layers: the foreground objects with the sky selected (center) on the top, and a more dramatic sky on a lower layer (right).
- You must be working with a layer that isn't the Background in the Layers palette. If the subject you want to mask is part of the Background, first Option/Alt-double-click the Background to convert it to a layer.
- Make sure the subject's layer is selected in the Layers palette and click the Add Layer Mask button in the Layers palette.
- A new layer mask appears (
). If needed, use any painting or editing tools to refine the layer mask by painting with black or white.
Figure 3.21 Clicking the Add Layer Mask button with the sky selection active adds a layer mask (left) to the current layer. Because the sky is selected, the new mask keeps the sky visible and hides the rest (center). This is the opposite of what we want, so with the layer mask selected in the Layers palette, we choose Image > Adjustments > Invert. That inverts the mask and gives us what we want: a mask that makes the old sky transparent and reveals the new sky.
As with channels, you can convert the layer mask to a selection at any time: Just Command/Ctrl-click the layer mask icon in the Layers palette. If these shortcuts don't work, make sure the document is in Standard mode, not Quick Mask mode.
Comparing Channels to Layer Masks
Extra channels (those other than the image's own color channels, such as RGB) don't directly affect the final look of the document (unless you export one along with an image, as an alpha channel). Compared to a channel, a layer mask does affect the final look of a document by applying transparency to a layer.
You'd typically create a new channel to store selections or transparency away in a file for later use, and you'd typically create a new mask to create transparent areas on a specific layer right now.
Scaling, Rotating, or Distorting a Selection Marquee
I created a selection that was just right, except that I needed to rotate and scale the entire selection. When I tried using the Free Transform command, it rotated and scaled the selected pixels, not the selection. How can I transform the selection but not the pixels?
As you discovered, the transformation commands on the Edit menu affect only pixels, not selection marquees. Instead, choose Select > Transform Selection ( Figure 3.22 ). With Transform Selection, the transformation bounding box works the way it does for the Edit > Free Transform command but only affects the selection marquee, not the image. When you're done, commit the transformation by pressing Enter or Return.
Figure 3.22 Using the Transform Selection command to rotate and scale an elliptical marquee to match the perspective of the clock face.
Spreading Out or Pulling In Selections
Sounds like you'll find the answer in the Expand/Contract commands. They don't scale selections—they offset them inward or outward. To spread out or pull in a selection, choose Select > Modify > Expand or Contract ( Figure 3.23 ). However, for really fine control over spreading or choking a selection edge, switch to Quick Mask mode, run a small Gaussian Blur filter on the mask (perhaps 1 pixel), then open the Levels command (Image > Adjustments > Levels). Drag the gray midpoint slider to expand or contract the selection in the channel, then click OK and leave Quick Mask mode.
Figure 3.23 Original selection (top left) and Expand Selection dialog box (left). Selection after entering 5 in Expand Selection dialog box (top center) and after entering -5 (top right).
Using a Selection as a Line Instead of an Area
Alternately, you can be more creative with that border, such as painting it with an interesting fill, by choosing Select > Modify > Border. After you enter a Width and click OK, the selection encloses the border of the original selection, instead of enclosing an area. Now fill it with something interesting, or run a filter.
Blurring the Edge of a Selection
When a selection is active, simply choose Select > Feather and enter the width of the edge blur you want ( Figure 3.24 ). Keep in mind that there won't be any visible change to the selection marquee after you feather the selection—you'll only see the effect of feathering after you apply a change to the selection in some way, such as filling it.
Figure 3.24 Choose Select > Feather to soften the edge of a selection.
For more control over the softening the edges of a selection, try these steps:
- Make a selection.
- In the Channels palette, click the Save Selection As Channel button to make a new channel from the selection.
- Apply a blur filter to the channel (
). If you want, you can use other blur filters and tools to get exactly the blur you want.
Figure 3.25 A channel resulting from a selection (top), and after applying the Gaussian Blur filter (bottom). When the channel is converted back to a selection, the selection border will be feathered by the blur created in the channel.
- In the Channels palette, Command/Ctrl-click the channel to convert it back to a selection. Because blurring the channel created grayscale values, the selection is feathered.
Transferring a Selection to Another Document
Piece of cake! Photoshop makes it possible to move selections between documents in two ways: as a "marching ants" selection or as a saved channels. To move the selection itself, make sure both documents are visible and drag the selection from one window to the next using any of the selection tools. If you want to center the selection, hold down the Shift key while dragging. (If the two images have the same pixel dimensions, the Shift key will make the selection appear in the same position as in the original file.)
Alternately, you could save the selection in the Channels palette and then drag the channel tile across to the other document or use the Duplicate Channel feature in the Channels palette flyout menu to copy it into the other file.
Selecting with Pen Tool Paths
Many people who are fluent with the Pen tool find it easier to set up selections by drawing a path and then converting the path to a selection. Paths can be much easier to edit for subjects that involve precise lines and curves. Instead of having to drag the mouse so carefully, as you must do with the marquee and Lasso tools, with the Pen tool you can adjust paths precisely by dragging handles, points, and segments as needed.
Another advantage of paths is that you can draw multiple paths, store them in the Paths palette, and convert them to selections at any time. Here's how:
- Select the Pen tool and click the Paths icon in the Options bar.
- Use the Pen tool to draw the outline you want (
Figure 3.26 A path around the top of the tower drawn using the Pen tool (A). The path saved in the Paths palette (B). This is repeated with a path drawn around a tower ornament (C). After Command/Ctrl-clicking the first path, Command/Ctrl-Shift-clicking the next path adds it to the selection (D).
- Paths are temporary unless you save them. To save the path with the document, double-click the temporary Work Path in the Paths palette to name it as a new entry.
- To save more paths, click in the empty area of the Paths palette and draw and save another path.
- In the Paths palette, Command/Ctrl-click the Work Path to create a selection from the path. (Or press Command-Return/Ctrl-Enter.)
- To build a selection out of multiple paths, Command/Ctrl-click a path in the Paths palette, and then Command/Ctrl-Shift-click the other paths.
Using Selections to Save Multiple Crops
Is there a way to save multiple crop areas within a single document? We've worked out preferred crop areas for various media like 4:3 aspect ratio TVs and widescreen TVs, and we'd like to save these crop areas in the master image.
Once you crop an image with the Crop tool and save the document, you can't retrieve the deleted area unless it still exists in a history state, or you applied the crop in Adobe Camera Raw, or you turned on the "Hide" feature in the Options bar with the Crop tool (see "Keeping What You Cropped," earlier in this chapter). However, you can sort of store multiple crop areas by saving selections in the Channels palette.
- Use the Rectangular Marquee tool to draw a selection rectangle around the crop area you want to save.
- In the Channels palette, click the Save Selection as Channel button, as we described earlier in this chapter.
- Repeat steps 1 and 2 for other crop areas you want to save.
- When you want to use a saved crop area, Command/Ctrl-click it in the Channels palette, and then choose Image > Crop. You might want to do this to a duplicate of the original image.