The Digital Eye: Vector Effects and Masking

As you may already know, there are essentially two types of still digital images—raster and vector images. Raster images are composed of a grid of colored pixels that define tonality and color.  A pixel is an individual square of colored light (see Figure 1) that usually so small that, when seen on a monitor their colors blend into what appears to be a continuous-tone image.

Vector images on the other hand, are objects defined by straight or curved paths (see Figure 2). These objects can be created and edited with special vector tools. Drawing programs such as CorelDRAW or Adobe Illustrator rely heavily on these tools and software like Corel Paintshop Pro or Adobe Photoshop which are primarily designed to edit pixels both have built-in vector features. These tools afford an entirely different way of creating and managing images. In this article I’d like to examine these tools and techniques to show you the advantages of vector-based graphics.

Pens and Arrows

Vector objects are composed of paths that mathematically define specific areas on the image by virtue of their shape and position. Paths are composed of anchor points and line segments, known as Bézier curves. The path tools enable you to create straight lines and

curves with great clarity and precision. A path, can be stroked with a color to form a line. If the two end points of the path are joined, the path encloses a shape that can be filled with a color or stroked with an outline (see Figure 3).

Vector tools deposit the components of the vector object using specific techniques to generate various types of paths. The Pen tool, found in all of the previously mentioned software programs, deposits anchor points and segments and direction handles. These elements form lines and shapes that can be very precisely controlled.

The vector tool group also consist of selection tools that are represented by arrow icons that manipulate the vector object after it has been drawn (see Figure 4).

By the way, these tools are also used in 3D modeling programs to create and manipulate wireframe objects that are ultimately wrapped with textures and bathed in light to produce very realistic images (see Figure 5).

Paths, Shapes and Pixels

There are several methods of applying vector objects to images. I’ll use Photoshop as an example, but many of these techniques are shared by the other software programs as well. A vector object can be generated as a simple path. Paths define a region of the image but have no content. They don’t print but they can be stroked and filled with pixels. The path is simply a guide for the stroke or fill. Paths can be drawn with the Pen tool or created with an extensive list of predefined shape tools.

A path can be created as a Shape layer. A shape layer is a hybrid object consisting of colored vector objects (see Figure 6). The advantage of using shape layers is that all of the attributes of layers can be applied to the vector including opacity, blend modes and layer styles.

Editing Paths and Shapes

The editing capabilities of vector objects are what make them desirable in a graphics workflow. Vectors once defined, can be edited with the Path Selection tool and Direct Selection tools. The former is used to size, rotate or move the vector object while the later edits anchor points, segments and direction handles. Let’s say for example, you want to draw an extremely smooth curved line. Try as you will with the brush tool, (the four cups of espresso you drank this morning are no help in steadying your hand)

…the Pen tool to the rescue! Deposit a point, click and drag to establish a direction, release the mouse and then deposit another point. Choose the Direct Selection tool and refine the shape of the path. Then and fill stroke the path with any brush size color using the Stroke Path feature in the paths panel—Viola!—perfect curves with a minimum of effort

(see Figure 7).

Vector objects on shape layers are also edited with the Path Selection and Direct Selection tools assuring accuracy and control. The color of the vector object on a shape layer is edited by double clicking the shape layer thumbnail in the layers panel to reveal the Color Picker.

Custom Shapes

The Shape tool fly-out in the Tools panel offers a selection of six pre-defined shape options, including the rectangle, round-cornered rectangle, ellipse, polygon, line and custom shape tool (see Figure 8). All of these tools deposit vector shape layers or paths when clicked and dragged on an image. There are controls in the Options bar to refine the attributes of these shapes and create stars (with the Polygon tool) and arrows (with the Line tool).

The Custom Shape tool presents a huge list of interesting graphic elements in a panel accessible from the Tool Options bar (see Figure 9). Furthermore, a custom shape that you design can easily be added to the list. First draw a closed path and then, from the Edit menu choose Define Custom Shape. In the dialog box that is displayed name the shape, click OK and the new shape appears at the bottom of the shape list to be applied to the image at any time and in any color or style you choose.

Vector Masks

Sometimes it becomes necessary to “knock out” portions of an image—that is, make specific layer content transparent so that elements in layers below can show through. One method of masking this way is to create a vector mask. A vector mask displays the layer content of the interior of the path while the area surrounding the path is completely transparent.

Vector masks are best used when you want a clean, crisp edge to your elements which is not always easy with regular selection methods. To create a vector mask make sure the content is on a Layer and not a Background. Choose Path from the pull-down menu in the Options bar. With the Pen tool or any of the Shape tools draw a path around an area of the image that you want to be visible. Use the Direct Selection tool to tweak the path so that it conforms nicely to the desired shape. 

With the path selected, choose Layer > Add Vector Mask > Current Path from the main menu. The path outline clips anything outside the path, making it invisible and allowing layer content from layers below to show through (see Figure 10). The vector mask is represented in the Layers panel to the right of your active layer by a gray and white thumbnail. The white represents the visible areas and the gray represents the transparent areas. Layer styles such as the Drop Shadow and Bevel & Emboss that are applied shown in Figure 11 appear at the edges of the mask.

By all accounts vector objects serve a very practical purpose in the computer graphics workflow producing clean edges and easily editable selections and clear, crisp masks. I must add that the vector tools (especially the Pen tool) take a little practice to master in that they are unlike any other kind of drawing. That being said, a few hours with these tools and they will become second nature to you and open a whole new world of image editing techniques.