## Wednesday, September 12, 2007

### Rasters and Vectors

I want to take a side trip from the "Math Without Math" discussion to talk about rasters and vectors. Since time immemorial (actually, probably early 1960's or so), these have been the two predominant ways of describing images displayed on the computer. Even today, most 2D graphics software falls into one or the other of these categories:

Raster
• Photoshop
• Painter
• Whatever came with your digital camera
Vector
• Illustrator
• InDesign
• Uh ... something else

So what's really going on here? The difference has to do with the way the software thinks about the picture it's working on. Raster software thinks the picture is just a bunch of colored dots, arranged in rows and columns, to make up a picture. It's kind of like a tile mosaic, or like one of those weird paintings by Seurat of people in very formal clothes trying to relax while they disintegrate into blobs of paint. There's no structure to the picture. The software knows nothing about which colored dots make up a face, and which ones make up a rock or a tree or anything else. There are just lots of dots.

Those mosaics of colored dots are called rasters, or sometimes bitmaps. Raster is an old term that comes from TV and video electronics, and describes how an old tube TV displays pictures by sweeping a beam of electrons across the glass screen. The electrons would hit dots of phosphor on the back of the glass, causing them to light up. Because the beams would sweep from side to side, top to bottom, they covered the whole screen, though the intensity of the beam would change, making some of the phosphor dots glow brighter than others. That's how a picture got drawn on a TV screen, and that's why pictures made up of dots of colors are called rasters. Each individual dot is called a pixel, short for "picture element."

As the picture below shows, the electron beam of a raster scan display sweeps back and forth over the screen in a kind of zig-zag pattern.

In each horizontal row, there would be some number of phosphor dots that could be made to glow brighter or dimmer, based on how intense the beam is when it hits that dot. The beam would swing left to right (seen from our side of the screen), then shut off and swing back to the left and down one row to begin the next row. In this way, every dot on the screen would get hit.

There was another kind of display screen called a vector display. In a vector display, the electron beam wouldn't sweep over the entire screen row by row. Instead, it would just go from point to point, according to the electronic signal it got. So it could draw a smooth line from one corner of the screen to the other, or draw a circle in the middle, or whatever. The lines and curves weren't made up of dots in the way the raster displays were. Instead, each line and curve was more or less a smooth, continuous shape, drawn by the electron beam.

There were advantages to each kind of display. The raster display could easily be adapted to show color, by using red, green and blue phosphor dots, and making them glow at different intensities to create various color mixes. (The dots were so close together that a person looking at the screen would basically see colors, rather than separate red, green and blue dots.) Also, because the raster display was painting every point on the screen, it was possible to display very photographic looking images like ... well, like TV.

Vector displays were somewhat more limited, but the quality of the lines and curves they could draw was magnificent, because they didn't have to draw a set of dots to look like a line, or a set of dots to look like a circle.

So a raster display might look like this:

but up close, you can see that it's just made up of colored dots ...

With a vector display, on the other hand, the quality is preserved, no matter how close you look, or how much you magnify the display:

Another way to think of this is that raster images store only the actual look of the image ... what colors go where, the same as taking a picture with a digital camera. Vector images, on the other hand, store the shapes that make up the image ... lines, circles, text, etc. In a sense, vector images are like instructions for drawing a picture:
• put a line from point a to point b
• draw a circle at point c
• put a rectangle with one corner at point d and one at point e
etc.

This is a very important difference in terms of what kinds of editing operations you can do, and I'll talk more about this later.