How to tell the difference between raster and vector files (or what are rastor and vector files).


Raster smiley face from Wikipedia


A very important concept for people who work with computers is understanding raster and vector files. Especially if you want to work in graphics or CAD, but also if you just want to expand your capabilities and understanding.

Lets start with the basics. Many formats exist which combine both raster and vector, but each is very different and its very important to understand them.

A raster file is simply a file made up of dots (pixels). Each pixel has its own color. For example, most files made with digital cameras are .jpg's. If you load one of the photos and zoom up really close, you will see clearly that is its made up of thousands of tiny dots. With normal viewing you are too far away to see the dots and instead they appear to simulate what we see.

The amount of these pixels in an image is referred to as the resolution of an image. Resolution is measured in two common ways: dpi (dots per inch) and megapixels. Dpi, or - Dots Per Inch tells you how many dots there will be in one square inch, this is why it is commonly used when getting ready to print something out. Megapixels is a measurement which was invented to sell digital cameras. Because megapixels measure the total amount of pixels in an image (X times Y) it sounds like a lot. This was a great sales technique in the early digital camera days. Now it serves to simplify the concept into one number, allowing people to easily compare the number of dots (resolution) in any device.

The color for each pixel of a raster file is represented on the disk by a number. This is easy for the computer to display but has the disadvantage that there must be one number for every single dot and therefore millions of numbers mean large file sizes.

Raster file Summary: A raster file, is a file made up of dots (pixels) the size/quality of which is called the resolution and is measured in dpi or megapixeles

A vector file is quite different. I'll start by explaining what a vector file is and then looking a the differences.

A vector file is a file does not use pixels to record image data. It does not have a resolution. What is recorded in a vector file are mathematical and graphic elements which allow the computer to draw/redraw the image on screen.

For example if I had a triangle in my vector file, this would be represented by the points at each corner. The first corner might be 0 across and 0 up (0,0) then the next corner might be 10 across and 0 up (10,0), the last corner could b 5 across and 6 up (5,6). This is the data the computer would store/use (more or less: Start= 0,0 : next point=10,0 : next point = 5,6 : close shape)

The advantage of this is that it is resolution independent. You can change its size and it will stay in perfect sharpness because the computer would simply redraw it after changing/scaling the co-ordinates. In the above example if we double the size we would get  Start at 0,0 draw line to 20,0 draw line to 10,12 draw line to 0,0.

The are many important reasons for representing the data this way. Vector files can be enlarged or reduced without the image quality being affected. Vector files can also be used as a cutting path for computer controlled cutting devices which need to move along a path (because they need co-ordinates for that path). Computer controlled cutting devices like those found in automated fabric cutting for the clothing industry or that cut adhesive vinyl for the sign industry are common examples of such. These machines need to know where to start and stop, when to move along an arc and when to move along a straight line etc.

The best way to do this is by putting points (called nodes) and other mathematical data into the file so that the computer can use it.


Also very important is that a computer can “understand” vector information much better. With a vector file, each letter is store as a nuber and referenced to a font. This make it easy to change letter and the curve data which represents each letter by changing the ascii number (that refers to which litter is being used) and also changing the font style (the computer with then take the shape data for each letter form a different font).

Summary of the difference between raster and vector files:

Vector and Raster files can both do what the file type can't.

Raster files handle photos better.  If you wanted to make a photo with a vector file, you would need to make millions of tiny objects represented mathematically and then filled with different color. This would be be impractically large and cumbersome compared to what could easily be done with a raster file.

Vectors files handle curve data better. If you only need to represent a circle and a square you only need to store a few points and some data for a few curves/straigh lines, but to do this with a raster file, you would need a large amount of pixels in order te show a smooth arc. In this case a vector file is much more efficient. Both type information and curve data can be easily edited with vector files.

Posted in You too can (how to articles)