Photoshop is primarily a raster image-editing program, designed to work with the pixels that make up a digital image. However, it does offer some rather powerful vector capabilities. Vector type, clipping masks, vector masks for layers, and Photoshop's shape layers are examples of vectors in raster images.
Vector artwork is based on paths that are recorded in a file as mathematical descriptions. The advantage of vectors is that artwork can be scaled to any size without loss of quality. Raster images, in contrast, can be drastically degraded when scaled either up or down. What this means is the work paths you draw can be scaled as large or small as you like within the bitmap image. If you are making use of a lot of shapes, scaling them may be necessary from time to time.
The Many Faces of Paths
Vector paths in Photoshop can exist independent of a layer, or they can be tied to a layer to create artwork. Vector type layers, for example, must contain nothing but the vector type (keeping in mind that any path on which you place type is independent of the layer). Likewise, shape layers can have no other artwork unless the layer is rasterized. Paths not used directly to create vector shapes or type can be used to create selections or masks for layers and can be stroked or filled.
Photoshop can use vector paths in a variety of ways:
Creating Paths in Photoshop
Paths can be created in a variety of ways. The Pen tools can be used to create paths from scratch, selections can form the basis of paths, shape layers are created with paths, and type can be converted to paths. Photoshop uses the Paths palette to manage paths.
A path is called a work path until saved. There can be only one work path at a time. With a work path selected in the Paths palette, you continue to add subpaths. If the existing work path is not active in the Paths palette when you begin to create a new path, it is replaced by the new path (which then assumes the name Work Path). The prior work path is lost. Renaming a work path saves it. You can change the name by double-clicking Work Path in the Paths palette and overtyping or by using the Paths palette menu command Save Path.
Remember that when a path is active in the Paths palette, creating another path with the Pen tool adds a subpath. Converting a selection into a path replaces an existing work path or, if the active path has been saved, starts a new work path.
To rearrange the order of paths, you can drag them up and down in the palette. This has no effect on their appearance.
Using the Paths Palette
The appearance of a path's name in the Paths palette gives you a good indication of what type of path it is. The palette also offers several buttons for use with paths (see Figure 7.23).
Figure 7.23. The Shape 1 Vector Mask path and the Layer 1 Vector Mask path would not normally be visible at the same timeonly one layer can be active, and an inactive layer's vector mask is not shown in the palette.
The Paths palette menu offers commands to create a new path or new work path; to duplicate, delete, fill, and stroke a selected path; and to convert a path to a selection or a clipping path. When a work path is selected in the palette, you can also use a menu command to save it, which opens a dialog box in which you can assign a name. However, you can achieve the same result by double-clicking Work Path in the Paths palette and typing a new name.
Using the Pen Tool
The Pen tool enables you to place each anchor point individually as you work, deciding between corner and smooth points on the fly.
You should remember a few basic concepts when working with the Pen tool:
Creating a path with the Pen tool can be as simple as clicking in two different locationsa straight path segment is created between the points. More complex paths can be created by clicking and dragging. The key to creating paths with the Pen tool is understanding how dragging affects curved path segments. In Figure 7.24, four paths were created by clicking and dragging with the Pen tool. In each case, the Pen was clicked and dragged straight down to form the left anchor point.
Figure 7.24. The dashed lines show the direction and distance of drag for each anchor point. Note that the left points for each of the path segments were created with identical drags.
The only difference among the four path segments shown in Figure 7.24 is the direction in which the Pen tool was dragged when creating the anchor point on the right side. (The distance is identical in each case.)
Both sets of curves in Figure 7.25 are excellent examples of smooth anchor points. The direction lines for both selected anchor points are 180° apartparallel to each otherand the path flows smoothly through the anchor points.
Figure 7.25. In the pair of images on the left, the dashed lines show the direction and distance of drag for each anchor point. The pair on the right show the direction lines for the anchor points.
The multiple-segment paths shown in Figure 7.25 illustrate the difference between dragging in opposite directions at each end of a path segment and dragging in the same direction. In the line shown at the left of the figure, each anchor point was created by dragging the Pen tool in the same direction. The second path was created by dragging in alternating directions. However, as you can see in the pair of lines on the right side of the figure, the actual direction lines for the anchor points between path segments look identical.
Note on the right of Figure 7.25 that, although only the two anchor points within the dashed box are selected (their squares are filled), one direction line for each of the neighboring points is visible. Even though those neighboring points aren't selected, the direction line for the path segment bordering the selected anchor point is available. This enables you to use the Direct Selection tool to modify the path segments from either end.
Understanding Pen Tool Options
When paths are placed close together, disabling Auto Add/Delete can make it easier to start a new subpath. Enabling the option in other situations can save you time switching tools.
When the Pen tool is active, the left part of Photoshop's Options bar offers you the choice of creating a work path or a shape layer (see Figure 7.26). (The option to create an area filled with the foreground color isn't available with the Pen tool.) You can also easily switch to the Freeform Pen tool or any of the Shape tools.
Figure 7.26. The Options bar differs, depending on whether Create Shape Layer or Create Work Path is selected.
When set to create a work path and a path is active in the Paths palette, the right side of the Options bar offers several different behaviors for a new subpath. You can add to, subtract from, intersect with, or exclude overlapping areas. The icons in the Options bar show the differences.
Selecting the Auto Add/Delete check box in the Options Bar enables the Pen tool to change to the Add Anchor Point and Delete Anchor Point tools automatically. If this option is selected and the Pen tool is positioned over a path segment, it automatically prepares to add an anchor point when you click with the tool. When this option is activated and the tool is positioned over an existing anchor point, it can be used to delete the point.
The style link button in the Options bar (available with a Pen tool or a Shape tool active) applies only to the Style pop-up palette in the Options bar. Changes made using the regular Styles palette are unaffected by the link status.
When the Pen tool is set to create or edit shape layers, additional options enable you to apply a style and color directly in the Options bar. You notice a link icon to the left of the Style example in the Options bar. When a style is selected, using the Style Link button links the Style pop-up palette to the active layer. Changes made to the style through the pop-up palette in the Options bar are applied to the active layer. When the link is not selected, changes to the style made in the Options bar do not affect the active layer.
Clicking the down arrow to the right of the shape tools in the Options bar exposes some additional tool-related options. For the Pen tool, you have the Rubber Band check box. With Rubber Band activated, the Pen tool previews the path that will be created by tracking the cursor's movement with the mouse button up. Without Rubber Band, you won't see the path until you click and drag. Additional options for the Freeform Pen tool are discussed in the following section.
Using the Other Pen Tools
In addition to the Pen tool, Photoshop offers the Freeform Pen, Add Anchor Point, Delete Anchor Point, and Convert Point tools. The Freeform Pen tool can be used to drag a path, much like using the Pencil or Brush tool. You don't have to click to add anchor points, however; the points are added automatically as you drag. (You can also add an anchor point to the path manually by clicking.) How closely the path follows the cursor's movement is a function of the additional tool options (accessed through the arrow to the right of the shape tool icons in the Options bar). The default Curve Fit setting of 2 pixels is usually a good balance between path accuracy and complexity. Higher numbers (to a maximum of 10 pixels) reduce the number of anchor points, but accuracy can suffer (see Figure 7.27).
Figure 7.27. The image at the bottom was traced with the Freeform Pen tool twice. On the left, Curve Fit was set to 2 pixels. On the right, the setting was 10 pixels.
The Magnetic option for the Freeform Pen tool enables it to follow edges. It uses contrast to determine where an edge exists. The Magnetic option is best suited for use on images with plain backgrounds.
When working with the Magnetic option, the Freeform Pen places a series of anchor points as it follows the path you trace. As you drag, you can click the mouse button to place anchor points at spots where the edge you're tracing takes a sharp turn. If the tool places an anchor point in an incorrect location, press the Delete key (Mac users) or the Backspace key (Windows users) to remove it. You can also back up along the edge to retrace a segment. Clicking the start point closes the path. Double-click the tool and it attempts to follow the nearest edge back to the start point. Pressing the Return or Enter key finishes the path and leaves it as an open path.
With the Freeform Pen tool selected, click the arrow to the right of the shapes in the Options bar to set the Magnetic option's behavior. Width determines the radius within which the tool searches for an edge to follow. Contrast, measured in percent, governs how different the pixel color must be to constitute an edge. Frequency controls how often an anchor point is placed as you drag.
When using the Freeform Pen tool with the Magnetic option, you can temporarily disable the capability by holding down the Option key (Mac users) or the Alt key (Windows users). With the key pressed, drag a freeform path without regard for following edges. Release the modifier key to resume using the Magnetic option.
With an existing path selected in the image, the Add Anchor Point tool enables you to add both corner (click) and smooth (drag) anchor points to the path. Similarly, the Delete Anchor Point tool removes existing anchor points from a selected path when you click them. You can use the Convert Point tool to change a smooth anchor point to a corner point (by clicking it) or to convert a corner point to a smooth point (by clicking the point and dragging).
When working with the Pen tool, you can enable or disable the Auto Add/Delete check box in the Options bar. This option, enabled by default, deletes or adds points automatically if you click existing points or segments in your path. If you disable this option, the Pen tool no longer edits existing points on the path; it only creates new points. This may be useful when drawing detailed images with the Pen tool where your points overlap. Most simple images can be drawn just fine with this option checkedin fact, it can be downright useful for creating pen drawings.
The Option key (Mac users) or Alt key (Windows users) converts the Pen tool to the Convert Point tool when the cursor is over an anchor point. You can use it to convert corner anchor points to smooth, and vice versa. Click and drag a corner point to create direction lines for a smooth point. Click once on a smooth point to change it to a corner point. You can also drag a direction point with the Convert Point tool to change the shape of only that side of the curve.
Paths as a whole can be edited, or you can work with subpaths or even individual anchor points and path segments. To select an entire path, click it in the Paths palette. You can stroke, fill, delete, and use the Edit, Transform commands.
To isolate a subpath from the entire path, use the Path Selection tool, whose icon is a plain black arrow (see Figure 7.28). Click the subpath in the image window to select it.
Figure 7.28. The path must be selected in the Paths palette to make it visible. You can then use the Path Selection tool to select a subpath, making its anchor points visible.
When you use the Path Selection tool to select a subpath, all the anchor points are selected. If you drag with the tool, you can reposition the subpath. You can also use the Paths palette menu commands to stroke or fill a selected subpath.
You can control the operation of the Path Selection tool in the Options bar using these techniques:
To select an individual anchor point or path segment to edit the shape of a path, use the Direct Selection tool, identified by the white arrow icon (see Figure 7.29). The Direct Selection tool has no options in the Options bar. Selected anchor points are identified as filled squares; anchor points in the same subpath that are not selected appear as hollow squares. (Other subpaths are visible, but their anchor points are not.) If a selected anchor point has direction lines, those lines will be visible.
Figure 7.29. The direction lines for the selected anchor point are visible, as is one direction line from each of the neighboring points. The additional direction lines are visible so that you can edit the path segments connected to the selected anchor point.
The Direct Selection tool can be used to drag an anchor point or a path segment or to drag direction points, which alters the shape of a curve. Remember that dragging a direction point for a smooth anchor point affects the direction linesand curveson both sides of the anchor, but changing a direction line for a corner point alters only the curve on that side (see Figure 7.30).
Figure 7.30. On the left is the original curve. In the center, you can see how dragging either of a smooth anchor point's direction lines changes the path segments on each side. On the right, the same curve with a corner anchor point has independent path segments.
To alter a curve connected to a smooth anchor point without disturbing the adjoining curve, hold down the Option key (Mac users) or the Alt key (Windows users) and drag a direction point. The smooth anchor point is converted to a corner anchor point with direction lines.
The Direct Selection tool can also be used to drag path segments. When a straight path segment is dragged, the neighboring anchor points move as well, altering not only the segment dragged but also those on either side. When you drag a curved path segment, the adjoining anchor points remain in place and the neighboring path segments are undisturbed. Note that dragging a curved path segment automatically converts any adjoining smooth anchor point to a corner point. In Figure 7.31, dashed lines represent the original paths, and you can see how dragging path segments affects shapes.
Figure 7.31. To the left, a straight path segment is being dragged. In the center, a curved path segment is being dragged straight up. On the right, you can see one example of what can go horribly wrong when dragging a curved path segment. To avoid the unexpected, click and drag in the middle of a path segment.
Stroking and Filling Paths and Subpaths
In Figure 7.32, a second window is open to show the effect of stroking and filling without the distraction of the visible paths. Choose Window, Arrange, New Window for [filename] to create the second window. It is automatically updated with changes made to the working window.
Figure 7.32. The buttons at the bottom of the Paths palette use the settings selected in the Stroke and Fill dialog boxes. Open the dialog boxes using the Paths palette menu, select the appropriate options, and afterward you can simply click the buttons to use the same settings.
To add color to an image, you can stroke and fill paths and subpaths. Use the Path Selection or Direct Selection tool to make the target path active. Make sure you're on the correct layer in the Layers palette. Use the Paths palette buttons or the commands from the Paths palette menu (see Figure 7.32), which open dialog boxes.
The Stroke Path dialog box (or Stroke Subpath, depending on the active selection) offers all the tools that use brushes. You can even apply the Healing Brush, Clone Stamp, and Pattern Stamp tools along paths for incredible precision.
The Fill Path (or Fill Subpath) options include filling with the foreground or background color or with a pattern, history state, black, white, or 50% gray. You can select a blending mode, opacity, feather radius, and anti-aliasing for the fill. Remember that filling an open patha path with two identifiable endsfills an area that includes a straight line between the start and end anchor points.
After you stroke or fill a path, the menu command Edit, Fade is available. You can use this command to change the opacity or blending mode of the stroke or fill. Remember that Fade is available only immediately after you apply the stroke or fill.
Making Paths from Selections
The Paths palette offers two ways to create a path from a selection. At the bottom of the Paths palette, the Make Work Path from Selection button loads an active selection as a work path. Alternatively, the Paths palette menu offers the Make Work Path command, which opens a dialog box where you can specify a tolerance setting. Ranging from 0.5 to 10 pixels, the Make Work Path command tolerance setting determines the accuracy with which the path is created as well as the complexity of the final path.
If a selection is heavily feathered or created from a mask, the path follows the marching ants (selection border), which indicates pixels at least 50% selected. If no pixels are at least 50% selected and you attempt to create a work path, a work path appears in the Paths palette, but there will be no anchor points or path segments.
Remember that when you create a path from a selection, you create a work path. It replaces any existing work path in the Paths palette. And, unless saved, it is lost as soon as you start another work path (although you can add more subpaths). Save a work path by renaming it in the Paths palette.
Compound paths can be created from selections, as shown in Figure 7.33. You can create the selection with selection tools, from a mask, or by using selection commands.
Figure 7.33. When the Option key (Mac users) or Alt key (Windows users) is used along with a selection tool, areas within a selection can be deselected. The Options bar also offers this capability for selection tools.
Compound paths can be used as vector masks for layers and as clipping paths for images to be placed in page layout programs (see Figure 7.34).
Figure 7.34. A compound path was created from a selection of the doughnut and used to mask an image of vegetables. Then the path was duplicated in the Paths palette and the copy converted to a clipping path. When placed in a page layout program, only the pixels between the paths are visible.
Converting Type to Paths
Creating paths from large amounts of small type can cause problems. The paths can be too complex to output properly.
Editable paths can also be created from vector type. With a type layer selected in the Layers palette, use the menu command Layer, Type, Create Work Path. The original type layer is untouched, and a work path is created in the shape of the letters (see Figure 7.35). Although the original type layer remains editable as text, the work path is no longer type. Before filling or stroking a work path, make sure you are on the appropriate layer.
Figure 7.35. The two existing layers have reduced opacity to better show the work path. The Direct Selection tool can be used to move anchor points and direction points, customizing the letter shapes. The paths can then be filled or stroked.