Whether Paths or Pixels Are Better

Whether Paths or Pixels Are Better

You choose between paths and pixels for different reasons. Paths are better for some things and pixels are better for others, and each approach has its strengths. The key to determining whether to use paths (which Illustrator creates) or pixels (from a program, such as Photoshop) is to be familiar with the capabilities of each method. Figure 2-1 shows path-based artwork next to pixel-based artwork.

Click To expand
Figure 2-1: Path-based artwork (left) and pixel-based artwork (right).

Paths are generally better for type, logos, and precision graphics. Pixels are generally better for photographs, complex backgrounds, textures, and simulated lighting effects. Quite often, however, the proper combination of paths and pixels results in the best final illustration possible. Determining what combination to use is a lot easier when you’re hip to the advantages and drawbacks of both paths and pixels.

Paths: The ultimate flexibility in graphics

Paths are used to define any shape from a simple square or circle to the shape of South America. Because paths are the outline of these shapes and not the shapes themselves, they take up very little storage space. A path-based square that measures 15 x 15 feet takes up no more room in your computer than a ?1-x-1-inch path-based square.

How can such a large square and such a tiny one accompany the same amount of computer memory? Through math, mostly. Looking at how Illustrator draws a square can help you make sense of all this information. To Illustrator, a square is simply a set of four locations — one for each of four points (the corners) — as well as any Fill or Stroke information (what color the square is). Where the points are doesn’t matter; what matters is that you have four of ’em and they make a square when you connect the dots.

What about complex outlines? A semiaccurate representation of South America with a limited amount of detail probably needs dozens of points to define the shape of the continent. In this case, there’s nary a straight line anywhere — from point to point, it’s nothing but curved lines. And because they need more information to describe them, those curved lines take up about twice as much disk space as straight lines do. Even so, a tiny little 1-inch-high illustration of South America can be enlarged to 15 feet tall and still have exactly the same file size because the illustration still has exactly the same number of points. Only the math that determines the location of those points has been changed to put them farther apart.

Figure 2-2 shows South America next to a square that physically appears to be about three times as large as South America (well, three times as large as the illustration of South America). Which one is bigger in terms of file size? South America is. It has more detail and, therefore, more points.

Click To expand
Figure 2-2: The South America shape is actually a larger Illustrator file than the square because more points are used to define the continent's shape.

What’s so cool about paths is something I previously alluded to: You can make paths much larger or smaller in physical dimensions without increasing the file size or losing image quality. You can rotate a path, flip it (reflecting), skew it (shearing), or distort it in a number of ways without changing the file size or detail. (Here’s the secret: All you’re really changing is the location of the points.) This near-effortless scalability makes Illustrator the perfect choice for creating logos that appear on business cards, letterheads, Web pages, various documents, banners, billboards, or signs.

Pixels: Detail and realism to spare

Pixel-based images are used for photographs because the fine “random” naturalistic detail is virtually impossible to create in a path-based image. Digitized photographs represent the majority of the pixel-based images in use today. The rest are mostly Web graphics and other on-screen images.

Technical Stuff?

Even a low-resolution pixel-based image can have 5,184 squares of color per square inch, each of which can be any of 16.7 million different colors. In a path-based image, every different color (with a few exceptions) must be defined by a separate path. To equal the number of different colors that you can create in a pixel-based image you’d have to draw so many paths that . . . well, imagine covering a basketball with confetti, one piece at a time. For this reason, pixel-based images are the hands-down choice over path-based graphics if you’re re-creating the continuous tones and irregular patterns found in nature, such as an outdoor scene with a lot of grass, trees, and furry animals.

On the other hand, paths are far superior to pixels if you want to maintain the quality of a graphic image despite enlarging and reducing its size. Think what you have to do to increase the size of artwork made with mosaic tiles. You have to increase the number of tiles unless you can enlarge the tiles that are already there. But if you did that, the tiles would be obvious from a distance. Same deal with pixel images. You have to add more tiles (pixels), or you see the pixels you already have showing up on-screen as big squares. And when you add pixels, you make the file size larger while reducing the quality (worst of both worlds) because you can’t get away with just tossing in any old pixels. An artisan ?may be able to add tiles to her mosaic and preserve its image quality, but the computer is just guessing about what tiles to add (in geek speak, a process called interpolation). There’s just no way to enlarge a pixel-based image without reducing the quality, as shown in Figure 2-3. Likewise, shrinking the image means throwing away pixels, which degrades the image because it then has fewer pixels available for showing detail. In technical circles, changing the number of pixels in an image is called resampling.

Click To expand
Figure 2-3: The effects of reduc-?ing and enlarging the image.

An image with thousands of pixels can be displayed on-screen or printed much larger with high quality than an image with only 900 pixels. Of course, all those pixels take up a whole lot more storage space on your hard drive. Path-based images have no such limitations.