Since my last post was about “pixels”, it got me thinking… a lot of people get confused about what a vector image is versus a bitmap or raster image. Maybe I can help clear things up a bit.
First of all, computers have to save all of the information they use somewhere. That information ultimately gets stored as a string of ones and zeros in the memory – be it the current RAM or archived on a hard disk. But how those ones and zeros are encoded can make a big difference when storing images.
Bitmaps
Let’s start with Bitmap (or raster) images. Picture a big piece of graph paper and let’s draw a big smiley face on it. In each of the squares of that graph paper, you could essentially assign it a color value. The color value would be broken up into Red, Green and Blue values each between 0 (meaning none) and 255 (meaning full color). Sure, that’s a lot of information for a computer to store, but they’re good at that.
You could imagine that as you’re drawing your nice round smiley face that some squares will be covered up only partially. The computer might handle that by storing a lighter shade of the color for that square, thus blurring the jagged edge a bit. But ALL the squares are accounted for in a bitmap – no more no less.
You might also think to yourself “wow, there’s a lot of white space on this paper – do all those squares need to be stored too”? Of course they do. The computer can’t guess or take shortcuts so it has to store each square with a value even if it’s blank. Now there are many compression methods like JPEG, GIF, and PNG that will take a bitmap image and reduce the redundant information drastically, but that’s a topic for a future post!
Bitmaps are great for storing pictures and other busy information. But what about text, lines, objects that you want to be able to resize?
Vectors
Vector images are a completely different idea altogether. The easiest way to think of vector is a set of instructions. If I tell the computer to draw a smiley face, I can do that with a relatively small set of instructions. For example, to start you could tell the computer to draw a circle starting at the middle of the screen and with a radius of say 200px. That piece of information when encoded into little ones and zeros can be extremely compact!
But efficiency isn’t the only benefit of vector graphics. Now that I have instructions for how to create my circle, I can easily modify it as well. I could stretch it and shrink it and all it does is change the original instructions without affecting the quality.
Imagine I have a graph paper 200 squares wide by 200 squares tall. If I drew my smiley face on it and then saved it as a bitmap, that information is etched in stone. Now I want to make my smiley face 400 squares by 400 squares big. You can imagine the quality is going to degrade. I’d have to “create” information by averaging values for all the new squares created.
But not with vectors. If my graph paper gets bigger, I just make the definition of my circle bigger. The magic is in the fact that the computer is constantly calculating which squares to light up depending on the definition of the object and the resolution of the “graph paper”.