The difference between a pretty-good-around-the-edges selection and a perfect one is what separates Photoshop pros from mere dabblers. As you’ll learn in the following pages, there are a bunch of ways to modify, reshape, and even save selections.
The best selection modifier in town is the Refine Edge dialog box (Figure 4-19), which is great for selecting the tough stuff like hair and fur. It combines several edge-adjustment tools that used to be scattered throughout Photoshop’s menus, and includes an extremely useful preview option.
Figure 4-18. Top: It’s worth taking a moment to try to see the shapes that make up the area you want to select. For example, you can select the circular top of this famous Texas building (shown in red) using the Elliptical Marquee, and then switch to the Rectangular Marquee set to “Add to selection” mode to select the area shown in green. Bottom: Another way to use the selection tools together is to draw a rectangular selection around the object you want to select, and then switch to the Magic Wand to subtract the areas you don’t want. Simply hold down the Option key (Alt on a PC) so you’re in “Subtract from selection” mode, and then click the areas you don’t want included in your selection, like this grayish background. With just a couple of clicks, you can select the prickly pear (which makes superb homemade jelly and wine, by the way!).
For the quickest selections in the west, try using the new Focus Area command to create an initial selection of the in-focus areas of your image, and then hand the selection over to Refine Edge for fine-tuning. Flip back to Creating Selections with Channels for the scoop.
Figure 4-19. The Refine Edge dialog box not only lets you see a live, continuously updated preview of what your selection will look like after fine-tuning, but you also get seven different views to choose from (Overlay is particularly handy if you’re dealing with hair or fur) and two tools you can use to refine your selection before clicking OK. If you forget what the dialog box’s various settings do, never fear: Just point your cursor at a setting and a tooltip appears explaining what it does.
Any time you have a selection tool active and some marching ants on your screen, you’ll see the Refine Edge button sitting pretty up in the Options bar; simply click it to open the dialog box. You can also open it by choosing Select→Refine Edge, pressing Option-⌘-R (Alt+Ctrl+R), or clicking the Properties panel’s Mask Edge button (see Figure 3-33).
The Refine Edge dialog box gives you seven different ways to preview your selection. (Because Photoshop displays the preview in the main document window, you’ll want to move the Refine Edge dialog box aside so it’s not covering your image.) Depending on the colors in the image, one of these View modes will let you see the selection better than the rest:
Overlay. As its name indicates, this view displays your selection overlaid with the Quick Mask (Using Quick Mask Mode), which, unless you’ve changed its color, is red. (The box on Changing Quick Mask’s Color explains how to change that color.) Because the red overlay is see-through, this view is the best choice when your selection will include hair or fur that isn’t included in the selection just yet. Keyboard shortcut: V.
On Black. This view displays the selection on a black background, which is helpful if your image is light colored and doesn’t have a lot of black in it. Keyboard shortcut: B.
On White. Choose this view if your image is mostly dark. The stark white background makes it easy to see both your selection and the object you’re selecting while you’re fine-tuning it using the dialog box’s settings. Keyboard shortcut: W.
Black & White. This view displays your selection as an alpha channel (The Mighty Alpha Channel). Photoshop makes your selection white and the mask black; transitions between the two areas are subtle shades of gray. The gray areas let you see how detailed your mask is, so you’ll spend a fair amount of time in this mode. Keyboard shortcut: K.
On Layers. To see your selection atop the gray-and-white transparency checkerboard, choose this mode. Keyboard shortcut: L.
Reveal Layer. This mode displays your image without a selection. Keyboard shortcut: R.
Once you’ve chosen a view, you can tweak the following settings (and for the best results, Adobe suggests you adjust them in this order):
Smart Radius. Turn this checkbox on to make Photoshop look closely at the edges of your selection to determine whether they’re hard (like the outline of your subject’s body) or soft (like your subject’s hair or fur). It’s a good idea to turn this setting on each time you open the Refine Edge dialog box. (If you turn on Remember Settings at the bottom of the dialog box, Smart Radius will stay on until you turn it off.)
If the edges of the object you’re trying to select vary greatly in softness (like a girl in a hat with long hair blowing in the wind), it can be helpful to copy parts of the image onto another layer so you can use a different Smart Radius setting. To do that, create a selection, press ⌘-J (Ctrl+J) to jump that bit onto its own layer, and then open the Refine Edge dialog box.
Radius. This setting controls the size of the area affected by Refine Edge—in other words, how far beyond the edge of your selection Photoshop looks when it’s refining that edge. You can think of this setting as the selection’s degree of difficulty. For example, if your selection is really complex, like the horse’s mane in Figure 4-20, increase this setting to make Photoshop look beyond the original selection’s boundary for all the wispy stuff (which also makes the program slightly soften the selection’s edge). If your selection is fairly simple, lower this setting so Photoshop analyzes just the selection’s boundary, which creates a harder edge. There’s magic numbers for this setting—it varies from image to image—so you’ll need to experiment to get your selection just right.
Refine Radius tool. Once you’ve turned on Smart Radius, you can use this tool (visible in Figure 4-19) to paint over the edges of your selection and make Photoshop fine-tune them even more in particular spots (see Figure 4-20, top). This is where the Refine Edge dialog box really works its magic: As you drag with this tool’s brush cursor, you can extend your selection beyond its original boundaries, creating a more precise selection of fine details. This tool is also intuitive: As you brush across the edges of your selection, it tries to learn how you want it to behave.
Erase Refinements tool. If Photoshop gets a little overzealous and includes too much of the background in your selection as you drag with the Refine Radius tool, drag with this tool across the areas you don’t want to include in the selection.
Smooth. Increasing this setting makes Photoshop smooth the selection’s edges so they’re less jagged, but increasing it too much can make you lose details (especially on selections of things like hair). To bring back some details without decreasing this setting, try increasing the Radius and Contrast settings.
Feather. This setting controls how much Photoshop softens the selection’s edges, which is useful when you’re combining images as discussed in the box on The Softer Side of Selections.
Contrast. This setting sharpens the selection’s edge, even if you softened it by increasing the Radius setting mentioned above. A higher number here creates a sharper edge (which can help Photoshop create a better selection) and can reduce the noisy or grainy look that a high Radius setting sometimes causes.
Shift Edge. To tighten your selection (make it smaller), drag this slider to the left—a good idea if you’re dealing with hair or fur. To expand the selection and grab pixels you missed when making the initial selection, drag this slider to the right instead.
Decontaminate Colors. This option helps reduce edge halos: leftover colored pixels around the edges of a selection that you see only after putting the object on a new background (see Fixing Edge Halos). Once you turn on this checkbox, Photoshop tries to replace the color of the selected pixels with the color of pixels nearby (whether they’re selected or not). Drag the Amount slider to the right to change the color of more edge pixels, or to the left to change fewer. To see the color changes for yourself, either choose Reveal Layer from the View menu near the top of the dialog box, or press R.
Figure 4-20. Top: After creating a rough selection with the Quick Selection tool, you can use the Refine Edge dialog box’s Refine Radius tool to brush across areas you want to add to the selection. Bottom: Within minutes, you can settle this mare onto a new background, as shown here. What horse wouldn’t be happier hanging out on a field of bluebonnets? To try this yourself, head to this book’s Missing CD page at www.missingmanuals.com/cds and download the file Horse.zip. When the Refine Edge dialog box is open, you can temporarily switch between the Refine Radius and Erase Refinements tools while pressing and holding the Option key (Alt on a PC). Alternatively, you can flip-flop between the tools by pressing Shift-E.
Selection merely leaves you with the new-and-improved selection, so you end up with marching ants on the active layer you started with. (If you’ve turned on Decontaminate Colors, this option is dimmed.)
Layer Mask adds a layer mask—based on the selection you just made—to the current layer. You’ll choose this option most of the time. (This option is also unavailable if you’ve turned on Decontaminate Colors.)
New Layer deletes the background and creates a new layer containing only the selected item, with no marching ants.
New Layer with Layer Mask adds a new layer complete with a layer mask based on your selection.
New Document deletes the background and sends only the selected item to a brand-new document.
New Document with Layer Mask sends the selected item to a new document complete with an editable layer mask.
Whew! Those settings probably won’t make a whole lot of sense until you start using ’em. To get you off and running, here’s how to select a subject with wispy hair, like the horse in Figure 4-20:
Open an image, and select the subject using the Quick Selection tool or the Focus Area command (Selecting with Focus Area).
Press W to grab the Quick Selection tool and paint across the object you want to select (Figure 4-20, top). Or, if your subject is in focus and the image’s background is nice and blurry, give the new Focus Area command a spin (Selecting with Focus Area). Don’t worry too much about the quality of your selection, because you’ll tweak it in a moment.
Hop up to the Options bar and click Refine Edge.
Choose Overlay as your View mode.
To see the horse’s mane better—in all its wispy goodness—press V to view it with a red overlay.
Turn on the Smart Radius checkbox and drag the Radius slider to the right.
There’s no magic Radius setting that works on every selection (a setting of 3.2 was used in Figure 4-20); how far you should drag this slider depends on your image. Your goal is to drag it as far to the right as you can while still maintaining some hardness in the selection’s edges. You won’t see much of anything change in your image when you tweak this setting, though a tiny rotating circle at the bottom left of the dialog box indicates that Photoshop is rethinking your selection.
Use the Refine Radius tool to brush across the soft edges of your selection (Figure 4-20, top).
Press E to grab this tool, or click its icon on the left side of the Refine Edge dialog box (it looks like a tiny brush atop a curved, dotted line). Then mouse over to your image and brush across the soft areas you want to add to the selection, like the wispy bits of the horse’s mane. Try to avoid any areas that are correctly selected (such as the horse’s nose), as Photoshop tends to overanalyze them and exclude parts it shouldn’t. If you end up adding too much to the selection, press and hold Option (Alt) to switch to the Eraser Refinement tool, and then brush across the areas you don’t want selected.
Turn on Decontaminate Colors and adjust its Amount slider.
Turn on this checkbox, and then drag the slider slightly to the right to shift the color of partially selected edge pixels so they more closely match ones that are fully selected. Once again, this value varies from image to image (15 percent was used for Figure 4-20).
From the Output To menu, choose “New Layer with Mask.”
Photoshop adds a layer mask based on your selection to the active layer, as shown in the Layers panel in Figure 4-20 (bottom).
Exhausted yet? This kind of thing isn’t easy, but once you master using Refine Edge, you’ll be able to create precise selections of darn near anything!
You can also use the Refine Edge dialog box to add creative edges to photos. For example, grab the Rectangular Marquee tool and draw a box about half an inch inside the document’s edges (Figure 4-21, top). Then click the Options bar’s Refine Edge button and, in the resulting dialog box, drag the Radius slider to the right for a cool, painterly effect (how far you drag it is up to you). Before you click OK, be sure to choose Layer Mask from the dialog box’s Output To menu to keep from harming your original image.
Figure 4-21. Top: The first step toward creative edges is to draw a rectangular selection around the image’s focal point. The wider the space between the edges of your selection and the edges of the document, the wider the soon-to-be-creative edge will be. Bottom: Once you turn on Smart Radius and drag the Radius slider to the right, the image’s edges begin to change. Use the remaining sliders to tweak the look to your liking. As you can see, the Refine Edge dialog box makes short work of giving images an interesting painted edge (here, the image is shown atop a deep-red solid color fill layer).
When you’re making selections, you may encounter edge halos (also called fringing or matting), a tiny portion of the background that stubbornly remains even after you try to delete it (or hide it with a layer mask as explained on Layer Blending). They usually show up after you replace the original background with something new (see Figure 4-22).
Figure 4-22. Here you can see the intrepid cowboy on his original green background (top) and on a new, blue background (bottom). The green pixels stubbornly clinging to his hat are an edge halo.
This aggravatingly tiny rim of color can be your undoing when it comes to creating realistic images because they’re a sure sign that the image has done time in Photoshop. Edge halos make a new sky look fake and won’t help convince anyone that Elvis actually came to your cookout.
Contract your selection. Open the Refine Edge dialog box (Creating Selections with Channels) and drag its Shift Edge slider left, or choose Select→Modify→Contract to contract the selection (the latter method doesn’t give you a preview). Use this technique while you still have marching ants—in other words, before you delete the old background (or, better yet, hide the background with a layer mask [Layer Blending]).
Run the Minimum filter on a layer mask. Once you’ve hidden an image’s background with a layer mask, you can run the Minimum filter on the mask to tighten it around the object. Video explains this super-useful technique, which is an excellent quick fix to have in your bag of Photoshop tricks.
Use the Defringe command. Run this command after you delete the background (alas, it doesn’t work on layer masks or while a selection is active). Choose Layer→Matting→Defringe, and then enter a value in pixels. Photoshop analyzes the active layer and changes the color of the pixels around the object’s edge to the color of nearby pixels. For example, if you enter 2 px, it’ll replace a 2-pixel rim of color all the way around the object.
Remove Black/White Matting. If Photoshop has blessed you with a halo that’s either black or white, you can make the program try to remove it automatically. After you’ve deleted the background, activate the offending layer, and then choose Layer→Matting→Remove Black Matte or Remove White Matte. (Like Defringe, this command doesn’t work on layer masks or while you have an active selection.)
If you peek at the Select→Modify submenu, you’ll find the same options as in the Refine Edge dialog box (but without a preview). There is, however, one addition: Border, which lets you turn a solid selection into a hollow one.
Let’s say you drew a circular selection with the Elliptical Marquee tool (Selecting by Shape). You can turn that selection into a ring (handy if you want to make a neon sign or select the outer rim of an object) by choosing Select→Modify→Border. Just enter a pixel width, click OK, and poof! Your formerly solid selection is now as hollow as can be.
Have you ever tried to make a slanted rectangular selection like the one shown in Figure 4-23? If so, you may have found the experience frustrating. Sure, you can try using one of the lasso tools, but it’s quicker to transform (meaning “reshape”) a rectangular selection instead. (The Transformers has more on the transform tools.)
When you use the Select→Transform Selection command to transform a selection—as opposed to part of your image—Photoshop won’t mess with any of your image’s pixels. The program merely changes the selection’s shape—in other words, the shape of the marching ants.
Once you’ve made a selection, choose Select→Transform Selection or Control-click (right-click) inside the selection and, from the shortcut menu that appears, choose Transform Selection. Either way, Photoshop puts a rectangular bounding box with square resizing handles on its four sides around the selection. You can move the selection around by clicking inside the bounding box and dragging in any direction. (To get rid of the bounding box without making any changes, press the Esc key.)
The bounding box’s resizing handles let you do the following:
Scale (resize). Drag any handle to change the size and shape of the selection. Drag diagonally toward the center of the selection to make it smaller or diagonally away to make it bigger.
Rotate. When you position your cursor outside one of the bounding box’s corners, the cursor turns into a curved, double-headed arrow. That’s your cue that you can drag to rotate the selection (just drag up or down in the direction you want to rotate).
Figure 4-23. Top: You can easily select the center part of this playing card with the Rectangular Marquee tool. Once you see the marching ants, choose Select→Transform Selection, and then rotate the resulting bounding box to get the correct angle. Bottom Left: Next, Control-click (right-click) inside the bounding box and choose Distort from the shortcut menu shown here. Then drag each corner handle so it’s over a corner of the beige box on the card. Bottom Right: When you’re all finished, press Return (Enter on a PC) to accept the transformation. Or, if you change your mind, press the Esc key to reject it.
If you need to change the shape of the selection, Control-click (right-click) inside the bounding box and you’ll see a shortcut menu with the following options (see Figure 4-23, bottom left):
Free Transform lets you apply any of the transformations listed below freely and in one action (instead of having to choose and apply them one at a time). See The Transformers for more info.
Scale and Rotate work as described in the previous list.
Distort lets you drag any handle to reshape the selection.
Perspective lets you drag any corner handle to give the selection a one-point perspective—that is, a vanishing point where it seems to disappear into the distance.
Warp makes Photoshop place a grid over the selection that lets you reshape it in any way you want. Drag any control point (the two evenly spaced points on all four sides of the selection) or gridline to twist the selection however you like, or choose a ready-made preset from the Options bar’s Warp menu.
Using Warp is your ticket to creating a slick page-curl effect. For the scoop, visit www.lesa.in/pagecurltut to see a tutorial on this technique.
Content-Aware Scale can intelligently resize the unimportant background areas of your image while keeping the subject unchanged. You’ll learn all about it on Content-Aware Scaling.
Puppet Warp lets you twist and turn the selection any which way you want, like Silly Putty. It’s covered in detail beginning on Reshaping Objects with Puppet Warp.
Rotate 180°, Rotate 90° CW, and Rotate 90° CCW turn your selection 180 degrees, 90 degrees clockwise, or 90 degrees counterclockwise, respectively.
Flip Horizontal and Flip Vertical flip your selection either horizontally (like it’s reflected in a mirror) or vertically (like it’s reflected in a puddle).
If you’d rather fine-tune selections by painting with a brush, no problem—in fact, you can even create a selection from scratch using this method. Just enter Quick Mask mode and you’ll find all of Photoshop’s painting tools (even filters!) waiting to help tweak your selection. This mode gives you the freedom to work on selections with almost any tool.
You can enter Quick Mask mode by pressing the Q key or clicking the circle-within-a-square icon at the bottom of the Tools panel (not the Layers panel). When you do, Photoshop looks to see whether you have an active selection and if so, it puts a red overlay over everything but the selection. (If you don’t have an active selection, you won’t see any change in your image, but you can still use the directions in this section to create a selection.) This color-coding makes it easy to edit your selection visually by painting.
Deselect a portion of the selection—in other words, add an area to the mask—by setting your foreground color chip to black and then painting across the unwanted area.
Extend the selection by painting with white in the spot you want to add (you may need to press X to flip-flop your color chips).
Create a soft-edged selection or semi-transparent area by painting with gray. For example, by painting with 50 percent gray (to do that, lower a black brush’s opacity in the Options bar to 50 percent), you’ll create a selection that’s partially see-through. You can create a similar effect by painting with a soft-edged brush.
All the usual tools and document tricks work while you’re in Quick Mask mode: You can zoom in or out by pressing ⌘ and the + or – key (Ctrl and + or – on a PC) or by using scrubby Zoom (Zooming In and Out), press and hold the space bar to move around within the document once you’re zoomed in, and use any of the selection tools covered in this chapter. You can also fill the entire mask—or the selection—with black or white (see Filling a Layer with Color and Filling a Selection with Color), which is helpful when you have a large area to paint or when you want to paint the entire selection by hand. You can also run filters in this mode to create interesting, similar to the one shown on Making an Object Sparkle.
Once you finish fine-tuning your selection, press the Q key to exit Quick Mask mode and the marching ants come rushing back, as shown in Figure 4-24, so you can see the newly edited selection.
If you create a selection that’s not in exactly the right spot or you’ve got several objects of the same shape that you want to select, you can move the selection itself. Or maybe you need to move the pixels underneath the selection, or move them onto their own layer. In any of those cases, you’ve got plenty of options:
Move the selection (the marching ants) within the same layer. Make sure you have a selection tool active (it doesn’t matter which one), and then click inside the selection and drag it to another part of the document. You can also nudge the selection into place with the arrow keys on your keyboard.
Move the selected object (the actual pixels) within the same document. Press V to activate the Move tool, and then drag the object to reposition it. Just be aware that a big, gaping hole will appear where the object used to be! (If you’re on a background layer, the hole will be filled with your current foreground color.) To duplicate the selection so you can move it to another part of the image without leaving a hole, Option-drag (Alt-drag on a PC) it instead.
Figure 4-24. Top left: To select the area around this badge, start by selecting the white background with the Magic Wand tool. Top right: When you pop into Quick Mask mode, Photoshop leaves the area you’ve selected in full color (in this case, white) and puts a red overlay over everything else. Now you can quickly clean up problem areas—like the drop shadow beneath the badge—because they’re so easy to spot with the red overlay. Use the Brush tool set to paint with black or white, or the Polygonal Lasso tool (and then fill the selection area with black or white). Bottom: Once you’re finished, press Q to exit Quick Mask mode, and you see the fine-tuned selection marked by marching ants.
You can also use the Content-Aware Move tool to scoot a selected object from one place to another. Jump ahead to Other Creative Madness for the scoop!
Move the selected object onto its own new layer within the same document. Press ⌘-J (Ctrl+J) to “jump” the selected pixels onto their very own layer, just above the current layer. Now, whatever you do to the selected area won’t harm the original image. If you don’t like your changes, you can throw the extra layer away or reduce its opacity if the change is a little too strong. (Flip back to Chapter 3 for more on layers.)
Move the selected object to another document. Press ⌘-C (Ctrl+C) to copy the selected pixels, open the other document, and then press ⌘-V (Ctrl+V) to paste the pixels. The pasted object appears on its very own layer that you can reposition with the Move tool. This technique is essential for performing the classic head swap shown in Figure 4-25.
Move the selected object to a new document. Copy the object as described in the previous bullet, and then choose File→New. Photoshop opens a new document, sized to match the object you copied; press ⌘-V (Ctrl+V) to paste the object.
Figure 4-25. Here’s a fun little prank to pull on your family, friends, and exes. Open a photo of someone and select their head using any of the selection tools discussed in this chapter (the Quick Selection tool was used here). Be sure to feather the selection so it doesn’t have a hard edge (see the box on page 154), and then copy it by pressing ⌘-C (Ctrl+C). Next, open the document that contains the new body, and then paste your selection into it by pressing ⌘-V (Ctrl+V). You can then use the Move tool to reposition the head onto its new body. If necessary, add a layer mask and fine-tune it to make the head blend a little better with the body. You can also use the Clone Stamp tool (page 447) on a new layer (set to sample all layers) to hide parts of the original head. Good times!
If you’d like Photoshop to remember a selection so you can use it again later, the program is happy to oblige. After you create the selection, choose Select→Save Selection. In the resulting dialog box (Figure 4-26), give your selection a meaningful name (like handsome devil), and then click OK. When you’re finished working with that document, be sure to save it as a PSD file (see File Formats).
Figure 4-26. If you think you’ll ever want to use a selection again, go ahead and save it—just in case. It’s also a good idea to save detailed selections that took you a long time to create.
When you’re ready to use the selection again, pop open the document in which you saved it, and then choose Select→Load Selection. In the resulting dialog box, pick your selection from the Channel menu (if you’ve saved only one selection in this document, Photoshop chooses it automatically). Leave the Operation section set to New Selection to bring back the saved selection as a whole (instead of adding to or subtracting from another selection), and click OK. The marching ants reappear, just like you saved them.
Although the radio buttons in the Load Selection dialog box’s Operation section let you add to, subtract from, or intersect other selections with the saved selection, it’s easier just to load the selection, close the dialog box, and then edit it using the selection tools discussed in this chapter.
Filling selections with color is a great way to create shapes and add colorful photo borders to images. After you’ve created the selection of your dreams, you can fill it with color in a couple of ways.
One option is to choose Edit→Fill and, from the Use drop-down menu, choose Color. Pick something nice from the resulting Color Picker, and then click OK twice to dismiss the dialog boxes. Photoshop fills your selection with the color you picked. A more flexible way to fill a selection with color is to add a solid color adjustment layer. Once you’ve made a selection, click the half-black/half-white circle at the bottom of the Layers panel and choose Solid Color (or choose Layer→New Fill Layer→Solid Color instead). Then grab a color from the resulting Color Picker and click OK. Photoshop dutifully fills the selected area with color, and a new solid color fill layer appears in your Layers panel. To change this layer’s color, simply double-click its thumbnail to reopen the Color Picker. (Chapter 3 has more on using solid color, gradient, and pattern fill layers.)
You have yet another option for filling selections: Content-Aware Fill, which works with the Fill command and the Spot Healing brush. You’ll learn all about it beginning on Content-Aware Fill.
Sometimes you’ll want to give your selection a stroke (as in an outline, not the medical condition). While you can stroke selections of any shape, this technique comes in really handy when you use it in conjunction with the Photoshop’s vector tools. You can stroke any vector shape you create—whether it’s with the Pen tool or one of the shape tools—with a variety of line widths and colors, including dashes or dots. This feature is covered on Customizing Stroke Options.
If you want to add a stroke to a pixel-based layer, you can do that with layer styles (Layer Styles). For example, when it comes to adding a bit of class to a photo, few effects beat a thin black outline (see Figure 4-27). If the image lives on its own layer, click the tiny fx at the bottom of the Layers panel and choose Stroke. In the resulting Layer Style dialog box, enter a size for the stroke, and then choose a Location from the drop-down menu (if the image is the same size as your document, be sure to choose Inside so the stroke appears inside the document’s margins). Last but not least, click the colored square to pop open the Color Picker and choose a color for the stroke. Click OK to close the Layer Style dialog box and call it done. To edit the stroke’s size or color later on, just double-click the stroke layer style in the Layers panel and the Layer Style dialog box pops open.
If the object you want to stroke isn’t isolated on its own layer—your image is comprised of several layers, say, as shown in Figure 4-27—then you can add the stroke to an empty fill layer. To do this, create a selection of your whole document by pressing ⌘-A (Ctrl+A). Next, click the half-black/half-white circle at the bottom of the Layers panel and choose Solid Color; when the Color Picker opens, immediately click OK to close it. Make sure the new fill layer lives at the top of your layer stack, and then drop its Fill setting to 0 (see Tweaking a Layer’s Opacity and Fill for more on this setting). Now you can use the fx button to add a stroke as described above.