## Raster vs Vector

Any program that has a visual component such as a "canvas" for you to view an image can be measured in pixels. Even if the program doesn't expose that number it has to make use of a rasterized array of pixels to send to your monitor or viewing device at some point so that you can see the image itself. But before that image is rasterized into a grid of pixels for display some of the internal elements, shapes, and / or text might exist as "vector" shapes (Note that many programs even allows vector shapes to coexist with raster images on the same document).

But what does that mean?

Computer science students might think of a "vector" as a type of list, Maths students might think of a "vector" as a direction. In digital art, both are somewhat true, as we are basically describing a list of directions.

Imagine a perfect square drawn on a board that is one meter by one meter. Starting at any given corner your direction to the next will be something along the lines of "turn 90 degrees and travel 1 meter distance to the next point". For digital art software a "vector" object is a series of points, and for each point an instruction to get to the next point. Sometimes these instructions might be as simple as a straight line, sometimes they might be curved lines, but they'll typically share the same features.

The basic qualities of vector tools are such;

• Vector objects usually contain no more than one color (but you can usually add color / texture via layers and masks, discussed elsewhere).
• Vector objects always have hard edges and borders and can not be blended with surrounding objects with a paint brush or smudging tool.
• Since they are just lists of mathematical values a purely vector document can sometimes only have a size of a few kilobytes. As opposed to raster images and videos which can be megabyres, even gigabytes in size depending on their contents.

Why would you want to make use of vector graphics? For a few reasons. Typically smaller file sizes, physical scalability (shrinking and enlargement), and ease of use. Let's explain how those things are possible.

### Size footprint

As you've seen a raster image stores color values for each pixel on the image (at least in uncompressed file types). Let's look at some math that might indicate exactly how much information you're storing.

• You have a raster image of a single layer that has a width of 1000 pixels and a height of 1000 pixels.
• The color of each pixel is recorded as three numbers for red, green, or blue channels.
• This means that the total number of integers we need for this relatively small image is 1000 x 1000 x 3. Or 3,000,000 integers total.

As you can see raster images can use quite a bit of information quite quickly.

Now lets look at the instructions to draw a single line using a vector plit.

• A curved line has two end points.
• Each end point has two handles.
• Each handle and end point is recorced as an X and Y position on the image, meaning each point will need six numbers at least.
• This means that the total number of required numbers is (2 + 2 + 2) * 2. Or 12 integers total.

Now in either situation your computer will have a keep a copy of the final image in memory, so working with vectors will not necessarily make your image *faster*, but you can see how the space required to actually store the image should be smaller using vectors.

Of course no image is made up of a single line however; so don't be surprised if a raster image actually ends up being smaller in terms of file size than an extremely complex vector image.

### Scalability

One thing that confuses beginners in graphic design is when they hear that vector images can be scaled up and retain their sharpness, but don't see that sharpness when they zoom in. Keep in mind that it doesn't if you are working in raster or vectors, the image has to be rendered to your screen as a raster because monitors themselves are made up of pixels. So even while you are working with vector shapes they are being automatically converted to raster images by your computer as the signal is sent to your monitor so that you can see them.

You will really only be able to see this particular strength of vector formats when scaling up an image. Also keep in mind the differences between scaling an image and simply zooming in. A zoom or magnify tool only makes the image larger on your screen to give you a better look and will not change the actual dimensions of a canvas, to do that you'll have to go through a menu option such as "image > image size" (this will change depending on your program).

## Editing Vector Images

The other benefit of vector images is their ease of use. Any by that we mean a complex shape can be made in quicker time than by trying to draw the same shape with most "brush" tools an image editor might contain. Smooth, curved lines especially will take much less time to set up as you want.

There are actually relatively few tools needed to edit vector images. Since we're talking about shapes that have definitive borders and no "falloff" the way a raster brush does we only need to worry about the line that creates the vector shape. This shape is our "path". They will be defined by an arbitrary number of points and the line segments between them will be straight or curved.

You'll find many programs have different types of categories for simple lines beyond just whether or not they are straight or curvy. Straight lines should be easy enough to understand so let's look at how curved lines are edited. There are a few different approaches to modeling a curve, and even though you'll see "Cubic" or "B-Spline" types in some 3d programs, most painting software will utilize the "Bezier" curve. Let's look at them one at a time.

### Parts of a bezier curve

A Bézier curve is a parametric curve whose shape is based on a velocity given to the start and ending points.

The Bezier approach has the user define a direction and distance for two or more points on a path. The distance being simple the space between points and the "direction" being a velocity for the line defined by handles. The 1st velocity is the direction the path will take *away* from the 1st point, the 2nd velocity is the direction the path will take *to* the 2nd point.

Now the "velocity" refers to the starting force more than anything, as the line does have to curve to meet up with the target point. Luckily the whole point of computer software is that we won't have to do those calculations ourselves!

So remember, for every Bezier curve there will be 3 essential components:

1. Points
2. Handles
3. Segments

Below is a very basic example of how a curve works. Click and move the points around in the following example to get a better idea of how this works.

By connecting several of these paths together we can make more advanced shapes. The image below is made with 3 curved segments arranged together. Note the purple handle lines showing the velocity of each curve point.

Keep in mind that even on a bezier curve not every point will have handles. It's possible to have a "hard" point where the curve to the next point is dictated soley by the handle of the next point. If two points in succesion have no handles the effect will simply be a straight line. But as long as at least one line segment on a shape can be controlled by these handles the entire shape is considered to be a bezier curve.

### Other curve types

The two next most popular types of path types are probably "Quadratic" & "B-Spline" path types. We'll touch on these only if we have time.

(Removed: Not pertinent right now.)

## Best Practices

Curve Fitting refers to making a curve, as a function or vector, fit a set of points as closely as possible.

One thing you'll always want to keep an eye on is the number of points you make use of. Generally you want to use as few points as possible, fitting to your desired shape, to create a shape unless there is a specific reason.

This will do two things.

• Taking advantage of computer's internal calculations will make curves smoother.
• It is easier to work with vector images made of fewer points than it is with images made of many poionts.

Both of these concepts should be made clearer by examining the following pair of images.

How to use Vector tools will be discussed in specific software package pages.