Teach Yourself Photoshop 4 in 14 Days

Previous chapterNext chapterContents


- 9 -
Paths

Seven days ago you learned about selections, and how selecting part of an image isolates that part so that you can work on it and not on the entire image. The problem with selections is that as soon as you remove the selection, it's lost forever. The only way to reselect something is to use the appropriate tools (Marquee, Lasso, and/or Magic Wand) and make the selection all over again.

Paths solve this dilemma. With paths (also called clipping paths), you can create and save specific selections for future use. The paths get saved right within the Photoshop file, sort of like a layer would be. What's more, those same paths can be used in other applications, such as Adobe Illustrator, Adobe PageMaker, and QuarkXPress. More details are coming later in this chapter. Finally, paths can also be useful when you want to create complex shapes by using the Pen tool.

Let's start by exploring the two different ways to create paths, and then go into techniques for editing and using them in Photoshop and beyond.

Creating Paths

You've got two paths you can take for creating paths (sorry, I couldn't resist):

Paths via Selections

Depending on the image at hand, this can be the easiest and quickest way to create a path. You simply make a selection and convert it to a path.

Let's look at an example. Figure 9.1 shows our test image, an open book on a flat-color background. If you want to isolate the book from the background, you can do so by selecting the book.

Figure 9.1
Our test image. We want a clipping path that outlines the book.

As you remember from Day 2, "Selections: Editing and Manipulating Images," selecting can be accomplished by using a number of tools. For this image, the Magic Wand is perfect because the background pixels are roughly the same color. Simply set the Magic Wand tolerance to about 25 (so you're sure to get all the background pixels), select the background, and then Invert the selection (Select+Inverse) so now the book image is selected (see Figure 9.2).

Figure 9.2
The book is now selected.

Now that you have a selection, follow these steps to convert it to a path:

1. Make sure that the Paths palette is visible. If not, choose Window+Show Paths.

2. Select Make Work Path from the pull-down menu at the upper right of the Paths palette (see Figure 9.3).

Figure 9.3
The pull-down menu of the Paths palette.

3. The only thing to set in the Make Work Path dialog box is Tolerance (see Figure 9.4). Tolerance refers to how closely Photoshop will follow the outline of your selection in creating the path. The smaller the tolerance, the more exact the path will be.

Figure 9.4
The Make Work Path dialog box.

You should also be aware that complex paths can be resource-intensive. More complexity means more points, angles, curves, and so on. The result can mean slower processing of the image, bigger files, and possible problems when printing. It is definitely something to be aware of.

For this image, I first tried a Tolerance of 5 pixels. As Figure 9.5 shows, the results were unacceptable. Photoshop was too flexible and approximate in creating the path at this setting. You can see that the smoother line of the path does not follow the outline of the book closely enough.

Figure 9.5
When the path doesn't match the selection to your satisfaction, Tolerance is set too high.

When this happens, simply reach for my favorite Photoshop command: Undo. Undo the path conversion and try a lower Tolerance setting. After some experimentation, I found that a value of 1 pixel worked quite well (see Figure 9.6).

Figure 9.6
When Tolerance is set correctly, the path matches the selection satisfactorily.

4. Congratulations! You now have a path any mother could love. Note how the path also appears in the Paths palette. Photoshop has named it "Work Path."

You can rename the path by simply double-clicking on it in the Paths palette. In the Save Path dialog box that appears, simply type the new path name and click OK (see Figure 9.7). The path is already "saved" as part of the file, so this dialog box is misnamed somewhat.

Figure 9.7
Rename paths by using the Save Path dialog box.


TIP: Although renaming paths isn't required, it's a good idea, especially if your Photoshop document will eventually have multiple paths in it. If you don't rename a path and then create a second path, the second path will replace the first path in the Paths palette. Don't worry: both paths will still exist, and you can still recover the first path by selecting it and choosing Save Paths from the Paths palette pull-down menu. But if that seems like too much hassle and confusion to you, simply rename each path as you create it!


NOTE: Saying that you've created "a path" is a little misleading. Actually, the path that you see consists of a number of subpaths that Photoshop has created. But for our purposes, they act as a single path.

One thing to remember is that any path you create is not really part of the image. That is, you aren't changing the actual image at all. Think of it as adding a new layer to an image, like a layer of clear acetate that helps you manipulate an image better but doesn't necessarily alter it in any way.

There's also another way to create a path from a selection. Make a selection; then simply click on the Make Work Path button at the bottom of the Paths palette (see Figure 9.8). Photoshop creates the path automatically by using the existing Tolerance setting. Don't forget to rename the path using the Save Path dialog box!

Figure 9.8
Here I'm creating a new path around the central graphic on the book's left page. Photoshop will use the same 1-pixel setting I used earlier.

Paths via the Pen Tool

Sometimes making a selection is too difficult or requires too much work on a particular image. In that case, consider using the Pen tool and drawing the path by hand.

If you've used vector-based illustration programs, such as Adobe Illustrator or Macromedia FreeHand, you already know about Bézier-based drawing tools like Photoshop's Pen tool. If you haven't used these kinds of tools before, you should know right up front that it takes a little practice, but the payoff is worth the effort.


NOTE: A Bézier curve is a curve defined by three points: one on the curve and two outside the curve at the ends of handles that you can use to change the angle and direction of the curve. If this sounds like gibberish, don't worry, you'll see some examples.

The best way to learn how to use the Pen tool is simply to play around with it in a new Photoshop document, so that's what we're going to do in this tutorial:

1. First, create a new Photoshop document big enough to move around in. 500 by 300 pixels sounds good. A plain white background looks good.

For reference, I've included my final Photoshop file for this example on the book's CD-ROM. It's called pen.psd.

2. Select the Pen tool (see Figure 9.9). Also make sure that the Paths palette is visible.

3. Click somewhere near the left-hand edge of the image. This is where your path will begin. (Notice that Photoshop immediately creates a path called "Work Path" in the Paths palette. This path can be renamed the same way as in the previous section.)

4. To draw a straight line, simply move your cursor and click somewhere else. You've just created a corner point, which means that Photoshop connects the two points with a straight line (see Figure 9.10).

Figure 9.10
A simple click creates a corner point and a straight line.

5. To continue the path but now with a curved line, move your cursor to the middle bottom of the window and then click and drag leftward. You'll see a curve immediately appear and change as you drag it (see Figure 9.11). You've just created a smooth point, which means that Photoshop will create a smooth curve where two curved line segments meet. (The straight line that you also see across the bottom of the window contains handles used to alter the point and curve; we'll look at that in a minute.)

Figure 9.11
A click-and-drag action creates a smooth point and a curved line.

6. To make this clearer, draw another smooth curve. Move your cursor to the center of the window; then click and drag to the right and a bit down. Again, a smooth point and a curve are created (see Figure 9.12).

Figure 9.12
Click and drag to create another smooth point on the same path.

Notice the point you created in step 5. It creates a nice smooth curve between the point you just created and the point you created in step 4. That's what a smooth point is all about.

As you have no doubt noticed, creating smooth points also results in the appearance of two handles for each point. These handles can be used to change the angle and direction of a curve after you've initially established it. You'll learn more about them later in the "Editing Paths" section.

Okay, that's the basics: straight lines via corner points and curved lines via smooth points. But there's more that you have to know about each one to use them effectively.

Corner Points

Corner points are easy. No matter what kind of line is coming into a corner point, the result is always an angle, not a curve. If a curved line comes into a corner point, it's the smooth point at the other end of that line that affects that line's angle at the corner point (see Figure 9.13).

Figure 9.13
Corner points surround a smooth point.

By the way, if you want to constrain corner points so they appear only at 45- or 90-degree angles, hold down the Shift key while you click to create the point.

Smooth Points

As you saw in the first Pen tool example, the behavior of smooth points is a bit more complicated, and takes some getting used to. A smooth point will always try to create as smooth a curve as it can between two meeting lines (see Figure 9.14).

Figure 9.14
Smooth points do their utmost to create curves out of any situation.

There is a less smooth kind of curve you can create for special occasions. It's called a sharp curve, and here is how you create one:

1. In a new Photoshop document, begin a path with an initial point.

2. Create a smooth point as you normally would.

3. Move the pointer so that it's exactly over the smooth point you just created. Hold down the Option key (Alt key on Windows) while you click and drag the mouse in the direction of the bump in the curve. Release the key and mouse button. Your screen should now look something like what you see in Figure 9.15.

Figure 9.15
Creating a sharp curve. The rightmost line is what I just created by using the Option (or Alt) key.

4. Move the cursor to where you want the line to end; then click and drag in the opposite direction you dragged in step 3. Figure 9.16 shows the resulting sharp curve.

Figure 9.16
The final sharp curve.

Previewing the Path

When you're creating all these points and lines, there's a preview feature that can be very helpful. Double-click on the Pen tool in the toolbar to bring up the Pen Tool Options palette. The only option here is called Rubber Band. Activating this feature enables you to preview both straight lines and curves before you click to create them. Experiment to see this feature at work.

Completing the Path

To complete a path, you have two choices: "close" the path by connecting the final point to the initial point, or leave the path "open."

A closed path means you have created a "loop," so the final path has no beginning or end. To close a path, use the following steps:

1. Create a path by using whatever points you need.

2. After the last point, move your cursor so that it appears on top of your initial point. You'll see a small circle next to the Pen pointer.

3. Click to create a final corner point, or click and drag to create a final curve (see Figure 9.17).

Figure 9.17
Closing a path with a final corner point click.


An open path means the path has a beginning and an end. Figures 9.10 through 9.16 have all been open paths. To end a path that you want to keep open, use the following steps:

1. Create a path by using whatever points you need.

2. After the last point, simply click on the Pen tool icon in the toolbar. The path now has an end.

The next time you click in the image, you'll be starting a new path instead of continuing your previous path.

Editing Paths

Most of the time, the initial path you create, whether produced by converting a selection or drawing with the Pen tool, won't be perfect. It's often too difficult to get the selection just right or the lines and curves perfectly placed on the first try. You have probably already realized this while following the previous steps in this chapter.

Fortunately, you can easily alter paths after they are created. And, once again, you use the Pen tool (and its associated tools) to do this.

The Path Tools

First, let's look at the various path tools available in Photoshop (see Figure 9.18):

Figure 9.18
Photoshop's path tools.

You can switch between these tools in one of two ways: either by clicking and holding down over the Pen tool in the toolbar, so the other path tools appear, or by pressing P on the keyboard, which will cycle through all the path tools one by one.

The best way to learn about these tools is through an example, so let's dive in. I'll use an example image with some irregular curves, so you're challenged to isolate the foreground (the head and shoulders) from the background (see Figure 9.19). (This Photoshop document appears on the CD-ROM; it's called head.psd.)

Figure 9.19
Our example image: let's draw and edit a path around this bizarre fellow's head, shall we?

1. I start by using the Pen tool and manually creating a path that more or less corresponds to the outline I'm aiming for (see Figure 9.20). My attempt is, well, fair at best. As you can see, the neck area is a bit sloppy, and there are some areas inside and outside of the drawn line.

Figure 9.20
The initial path as created by the Pen tool and me.

2. First, I want to see how much I can correct simply by moving the points and the handles used to control those points. I select the Direct Selection path tool and decide to focus on the top of the head, where the path isn't quite lining up. I select the very top point by clicking it once. It turns into a "filled-in" square instead of the square outlines that represent the other points.


NOTE: If you have a path but can't see any points, that simply means that the path isn't selected yet. Using the Direct Selection tool, click anywhere on the path line, and the points will appear.
3. The handles of this smooth point now appear, one on each side. I click on the right-hand handle and drag it around, seeing how different locations change the curve. When it matches the curve of the image, I release the mouse (see Figure 9.21).

Figure 9.21
Moving handles can correct the path in some places, but also adversely affects others.

4. Unfortunately, I've fixed one side of the top of the head, but now the other side is even worse. Fortunately, I can grab the other handle and move it separately, correcting the curve somewhat. I make other curve corrections in the same way, by selecting points and moving handles (see Figure 9.22).

Figure 9.22
After moving a few handles, the path is looking a bit better.

5. The Direct Selection tool enables me to do more than move handles. I can also move the points themselves. With the tool still selected, you can click and drag the point itself to the correct location. By moving the very top point a bit to the right and the left top point a bit higher, I can get the path around the head looking pretty good (see Figure 9.23).

Figure 9.23
Moving points and handles usually solves most of the problems.


NOTE: Photoshop also enables you to move multiple points simultaneously. To select more than one point, hold down the Shift key as you click on points or drag a marquee around the points you want to select. Then you can move them all at once.
6. However, I still have an odd problem on the right cheek that I can't seem to correct. What I really want is another point on the cheek to extend the curve a bit. No problem. I select the Add Anchor Point tool, and click and drag on the line on the spot where I want the new point. I move that new point out a bit, adjust the handles, and the path now follows the cheek nicely (see Figure 9.24).

Figure 9.24
Sometimes adding a new point is the perfect solution.

When using the Add Anchor Point tool, remember that if you want a corner point, a simple click will do to create one. But if you want a smooth point, you have to click and drag. Also, you can't make a sharp curve directly, but instead must make a smooth point and then convert it to a sharp curve by using the Convert Anchor Point tool (see the next section).

(If you ever need to delete a point, you can easily do so with the Delete Anchor Point tool. Simply click on the point, and it disappears. The curve gets redrawn according to the points that still exist.)

Other Editing Capabilities

But wait, there's more! Your toolbox for editing paths is not yet empty. You can also change existing points, delete line segments, add to a path, and more.

If you ever need to convert a point from one type to another, use the Convert Anchor Point tool. To convert a smooth point or a sharp curve to a corner point, just click on it. To convert a corner point or a sharp curve to a smooth point, click and drag. Finally, to convert a smooth point to a sharp curve, move just one of the point's handles.

If you ever have a path from which you want to delete just one segment, all you need to do is select the line or curve between the two points (using the Direct Selection tool) and then press Delete (Backspace on Windows). The line segment disappears.

If you ever want to delete an entire path, drag the path's name to the Trash Can icon in the Paths palette, just as you would throw away a layer.

Adding to an existing path is also easy. With the Pen tool selected, click on an endpoint of the path. Now you can continue the path as if you'd never stopped, adding points as desired.

You can even duplicate a path, either in parts or in its entirety. Use the Direct Selection tool to select the desired parts of the path, and then simply copy and paste. A clone is instantly created (see Figure 9.25).

Figure 9.25
Duplicating part of a path.

Basic Path Techniques

You've probably already figured these out on your own, but just in case, here are a few basic techniques for navigating among and using paths:

Using Paths

So what can you do with paths after you've gone to all the trouble of creating them? Well, a lot of things. In Photoshop, you can use paths to remember selections that you want to use repeatedly. You can also fill a path area or define the color, border, and so on of the outline of the path.

Further, you can use paths you create in Photoshop within other applications. Illustrator is particularly useful for dealing with paths, as you'll see later on. Finally, you can use paths as clipping paths in other programs, specifically page layout applications.

Using Paths in Photoshop

There are three primary uses for paths in Photoshop: as permanent selections, areas to be filled, or outlines to be stroked.

Turning Paths into Selections

In Photoshop, paths are most useful as permanently saved selections. This can be incredibly helpful when you think you might want to reuse a specific selection later. When in doubt, create a path so that the selection will always be available!

You already learned how to convert a selection to a path. Here's how to convert a path into a selection:

1. Create a path through whatever means suit your fancy.

2. Activate the path you want to convert by clicking on it in the Paths palette.

3. Choose Make Selection from the pull-down menu at the top right of the Paths palette.

4. In the Make Selection dialog box that appears, you can set the tolerance of the selection that Photoshop creates (see Figure 9.26). The higher the Feather Radius setting, the less exact the selection will be.

Figure 9.26
The Make Selection dialog box.

Click OK, and you'll see the path turn into a selection.

There are also two shortcut methods for converting a path to a selection:

Figure 9.27
The button for converting a path to a selection.

Neither of these methods brings up the Make Selection dialog box, so Photoshop uses the previous Feather Radius setting.

Filling Paths

Filling a path means just what you'd expect. Select a path, choose Fill Path from the pull-down palette menu, and you'll get the same kinds of options you get for filling a selection (see Figure 9.28). In the Fill Path dialog box, you can choose a color, a pattern, or a snapshot to fill the area with. You can also choose a blending mode, opacity percentage, optional transparency, anti-aliasing, and a feathering value (everything you already learned on previous days).

Figure 9.28
The options for filling a path.

Stroking Paths

Stroking a path means affecting the outline of the path, not the entire area enclosed within a path. Select a path and then choose Stroke Path from the pull-down palette menu. The dialog box enables you to choose the tool you want to use, from Pencil and Paintbrush to Blur and Sponge.

Whatever tool you pick, Photoshop uses that tool's current settings to create the result. So, for example, if you want to airbrush the path outline with only 60% pressure, make sure that value is set in the Airbrush Options palette before you select Stroke Path.

Figure 9.29
Mr. Weirdo with a stroked path via the Airbrush tool.

By the way, there are shortcuts for filling and for stroking. Hold your mouse pointer over the buttons at the bottom of the Paths palette, and you'll see the options.

Exchanging Paths with Illustrator

Adobe Illustrator, if you recall, is a vector-based graphics program, which means that it's entirely based on points, lines, and curves. So it's a perfect environment for paths, and you can exchange paths between Photoshop and Illustrator.

From Photoshop to Illustrator

Why would you want to use Photoshop paths in Illustrator? Primarily because each tool has its own strengths, and you want to capitalize on those strengths. If your paths need a lot of editing, you might consider bringing them into Illustrator because the latter program's path editing features are more robust and flexible. Then when you're done, you can take the paths back into Photoshop.

On the other hand, Photoshop produces more accurate results than Illustrator for defining a path initially. Illustrator's autotracing feature isn't always very accurate, but with Photoshop you can be as accurate as you want with selections and then convert the selections to paths. Thus, you might want to create paths in Photoshop that will be later used in Illustrator to create something like a logo or icon.

To export a path to Illustrator, follow these steps:

1. Create the path you want.

2. Select it by clicking on it in the Paths palette.

3. Choose File+Export+Paths to Illustrator to bring up the export dialog box (see Figure 9.30).

Figure 9.30
The dialog box for exporting paths to Illustrator.

4. From the Write pull-down menu, you can choose to include just the one path you selected (in the figure, "Book Path"), Document Bounds (which will create a document that contains one path that simply defines the overall size and shape of your Photoshop document), All Paths (which exports all the paths in the Photoshop document), or any path in your Photoshop document by name.

5. Click on OK. Now you can simply open this new file in Illustrator and see the accessible path.

From Illustrator to Photoshop

I already mentioned one reason you might want to bring paths from Illustrator to Photoshop: Photoshop can be more accurate in defining paths. Any time you take an image from Illustrator to Photoshop, the paths you need to make Photoshop selections already exist in the Illustrator file.

Here's how to convert paths from Illustrator:

1. In Illustrator, select the paths you want to convert.

2. Copy them.

3. Switch over to Photoshop and paste them into your document.

4. You'll see a dialog box asking how you want to paste. Choose Paste As Paths and click OK.

The paths will now be ready for use. Easy!

Bringing Paths into a Page Layout Program

The final primary use for paths is for page layout programs, such as PageMaker and QuarkXPress. If an image you bring into PageMaker has a clipping path, you can silhouette that image in PageMaker--everything outside the clipping path will become transparent.

If you're going to use clipping paths in this way, it's recommended to use the EPS format for your image. TIFF also supports clipping paths, but not all applications support TIFFs with paths, so you're safer with EPS.

Here's how to do it:

1. In Photoshop, create and select the path of your choice.

2. From the Paths palette pull-down menu, select Clipping Path.

3. In the resulting dialog box, make sure that the correct path is selected and set the Flatness (see Figure 9.31). This value defines just how accurately the path is followed when the image is printed. The higher the value, the more exact the path. For low-resolution printing (300-600 dpi), use values in the 1-3 range. For high-resolution printing (1,200-2,400 dpi), try 7-10. Be forewarned that sometimes high values can cause printing problems, and often increase printing time.


TIP: It's often a good idea to simply leave the Flatness setting blank. This will instruct the application to let each printer use its own built-in flatness settings to decide on the value, which is often the best strategy.

Figure 9.31
The Clipping Path dialog box.


NOTE: Only printers that support at least PostScript Level 2 will print clipping paths.
4. Click OK, and save the image as a TIFF or EPS file. (Only TIFF and EPS files support clipping paths.) Then you can switch over to PageMaker or QuarkXPress, import the graphic as you would any other graphic, and see the image clipped as you wanted it (see Figure 9.32).

Figure 9.32
The clipped head in PageMaker.


By the way, if you're using EPS files as recommended, you can skip steps 2 and 3 and activate the clipping path directly in the EPS Format dialog box that comes up when you save a file as a Photoshop EPS file (see Figure 9.33). Just set the path name and Flatness value here, click on OK, and you'll get the same result.

Figure 9.33
Defining a clipping path as you save as EPS.

Summary

The path is a magical Photoshop feature that has many applications in your daily Photoshop existence. You can use paths as permanent Photoshop selections that can be reused anytime, as methods to fill or stroke part of an image, as a way to convert areas of an image or work on an image in Illustrator, or as clipping paths to be exported into a page layout program. Photoshop provides an array of tools and options for creating paths: you can do so by converting a selection you have already made, or by drawing a path from scratch by using the Pen tool. You can also edit existing paths with the assorted path tools.

Paths--just another step on the path to Photoshop success!


Previous chapterNext chapterContents


Macmillan Computer Publishing USA

© Copyright, Macmillan Computer Publishing. All rights reserved.