Raster vs vector graphics
Open the interactive version →← Concepts
PIXELS OR MATHS?
Every picture on a screen is stored in one of two ways. Zoom in to find out which.
Why does a logo stay sharp on a giant banner, but a phone photo goes blocky when you zoom right in?
The photo is a raster image: a fixed grid of coloured squares (pixels). Zooming in just makes each square bigger. The logo is a vector image: it is stored as points, lines and curves (maths), so the computer redraws it sharply at any size.
TWO WAYS TO STORE A PICTURE
Raster and vector
A grid of tiny squares called pixels. Each pixel stores one colour as three numbers: how much red, green and blue. More pixels means more detail, and a bigger file.
Photos, scans, screenshots, paintings in apps such as Photoshop, GIMP and Procreate.
A list of instructions: points (called nodes or anchor points), the lines and curves that join them, and the colours to fill and outline them. The computer works out the pixels each time it draws the picture.
Logos, fonts, icons, laser-cut parts, made in apps such as Illustrator, Inkscape, CorelDRAW and 2D Design.
TRY IT
The zoom lab
The same light bulb, stored both ways. Zoom in, then drag either picture to look around.
Raster 32 × 32 pixels = 1024 pixels × 3 numbers = 3.0 KB
Zoom in and point at a pixel to see the numbers it stores.
Vector 5 paths, 31 nodes = 945 bytes of text
Zoom as far as you like: the edges stay sharp, because the curves are redrawn from their numbers.
Why does "Smooth the pixels" look blurry?
Smoothing guesses in-between colours by blending neighbouring pixels. It hides the blocks, but it cannot add detail that was never stored, so the picture just goes soft. The only real fix is a higher-resolution image, or a vector.
INSIDE A VECTOR
A curve is just four points
This whole curve, as it is stored in an SVG file: <path d="M 40 215 C 80 40, 300 30, 360 215" />
How does the computer find each point on the curve?
It slides a value t from 0 (the start) to 1 (the end). For each t it finds the point that fraction of the way along each grey line, joins those points (green), does the same again (orange), and again, until only one point is left: that point is on the curve. Use the slider to watch it. This is called a Bézier curve, after Pierre Bézier, an engineer who used it to design car bodies at Renault in the 1960s.
B(t) = (1 − t)³P₀ + 3(1 − t)²t P₁ + 3(1 − t)t² P₂ + t³P₃
OBJECTS, NOT PIXELS
Stacking order (z-order)
In a vector drawing every shape is a separate object, stacked one above another. Pick a shape (tap it or use the list), drag it, and change its place in the stack.
LAYERS (front first)
- Yellow star
- Green triangle
- Red circle
- Blue square
COMBINING SHAPES
Union, subtract, intersect, exclude
Union joins the shapes into one outline: everything inside either shape.
Challenges: can you make these?
- A crescent moon from two circles. Subtract, with circle B overlapping the edge of circle A.
- A leaf (lens) shape from two circles. Intersect, with the circles half overlapping.
- A rounded tab for a laser-cut box. Union of a square and a circle on one edge.
- A square with a star-shaped hole. This needs the square as A: try it in 2D Design or Inkscape, where you choose which shape is subtracted.
In 2D Design, Inkscape and Illustrator these are called union / weld, subtract / difference, intersect and exclude / XOR. In 3D CAD (Fusion, Onshape, Tinkercad) they are join, cut and intersect: modelling by combining solids this way is called constructive solid geometry.
Side by side
| Raster | Vector | Made of |
|---|---|---|
| A grid of pixels, each one colour | Points, lines, curves and fills (maths) |
| Enlarging |
|---|
| Goes blocky or blurry |
| Stays sharp at any size |
| Detail |
|---|
| Good for photos, textures and subtle shading |
| Best for flat colours, clean shapes and text |
| File size |
|---|
| Grows with the number of pixels |
| Grows with the number of shapes, usually small |
| Editing |
|---|
| Paint and erase pixels; shapes cannot be picked up again |
| Every shape can be moved, resized, recoloured or reshaped |
| File types |
|---|
| JPEG, PNG, GIF, WebP, HEIC, TIFF |
| SVG, PDF, AI, EPS, DXF |
| In the workshop |
|---|
| Laser engraving photos, mood boards, textures for renders |
| Laser cutting and scoring, vinyl cutting, CNC routing, logos |
Resolution: pixels per inch
Resolution is how many pixels fit in a length. Printing usually needs about 300 pixels per inch (ppi, often called dpi) to look sharp, so a photo that looks fine on screen can print blocky if it is enlarged. Camera resolution is given in megapixels: a 12-megapixel photo is about 4000 × 3000 pixels.
Converting between them
Vector to raster (rasterising) is easy and always works: the computer just works out the pixels. Every screen and printer does this whenever it shows a vector, because screens are grids of pixels too. But once saved as pixels, the shapes cannot be edited as objects again.
Raster to vector (tracing or vectorising) is harder. Tools such as Inkscape's Trace bitmap or Illustrator's Image trace find the edges between colours and draw curves along them. It works well for bold sketches and logos, but photos turn into thousands of shapes. A good trick for laser cutting: draw your design in thick black pen, scan it, trace it, then tidy the nodes. Inkscape tutorials ↗
SORT IT
Raster or vector?
Choose for each one.
- A photo of your finished prototype Raster Vector
- The logo for your product Raster Vector
- Cut lines for the laser cutter Raster Vector
- Engraving a photo onto plywood with the laser Raster Vector
- A sticker for the vinyl cutter Raster Vector
- Pictures on your mood board Raster Vector
- The letters in a font Raster Vector
- A hand sketch you scanned in Raster Vector
- A DXF file for the CNC router Raster Vector
- A wood-grain texture on a CAD render Raster Vector
NOW AND NEXT
Cutting-edge computer graphics
Raster and vector are still the two ways to store a flat picture, but the tools built on them are changing fast. A twist: when a graphics card draws a 3D model, it turns each triangle into pixels. That step is also called rasterisation.
- One ray for each pixel: from the camera to the object, then towards the light to check for shadow. Image: Henrik, CC BY-SA 4.0 (licence), via Wikimedia Commons Real-time ray tracing Graphics cards can now follow the paths of light rays as they bounce, reflect and cast shadows, fast enough for games and live CAD views. Product renders that once took hours appear in seconds. In DT: Photo-realistic renders of a design before anything is made: you can test colours, materials and finishes with a client. Find out more: Ray tracing (Wikipedia) ↗ Pixar in a Box: rendering (Khan Academy) ↗ CAD/CAM →
One ray for each pixel: from the camera to the object, then towards the light to check for shadow. Image: Henrik, CC BY-SA 4.0 (licence), via Wikimedia Commons
- Left: the small original. Right: the AI's guess at a version four times bigger. Image: PantheraLeo1359531, CC BY 4.0, cropped (licence), via Wikimedia Commons AI upscaling AI tools enlarge a raster image by predicting the missing detail, instead of making bigger blocks. Games use it to draw fewer pixels and fill in the rest. In DT: Useful for rescuing a small photo for a portfolio, but the new detail is a guess: it was never in the original. Find out more: Deep learning super sampling (Wikipedia) ↗ Super-resolution imaging (Wikipedia) ↗ Artificial intelligence →
Left: the small original. Right: the AI's guess at a version four times bigger. Image: PantheraLeo1359531, CC BY 4.0, cropped (licence), via Wikimedia Commons
- The AI starts from random noise and removes a little more of it at every step. Image: Benlisquare, CC BY-SA 4.0, rearranged (licence), via Wikimedia Commons Generative AI images Image generators build a picture from a text prompt, almost always as a raster image. Newer tools can also produce simple vector graphics such as icons. In DT: Fast mood board and concept images, but they are not your own design work: reference them and check your school's rules. Find out more: Text-to-image models (Wikipedia) ↗ Artificial intelligence →
The AI starts from random noise and removes a little more of it at every step. Image: Benlisquare, CC BY-SA 4.0, rearranged (licence), via Wikimedia Commons
- First step of a scan: the software works out where each photo was taken from (each pyramid is one camera). Image: Colin Kranz, CC BY-SA 4.0 (licence), via Wikimedia Commons 3D scanning and Gaussian splatting From a short phone video, software builds a 3D scene out of millions of soft, coloured blobs ('splats'), or a mesh of triangles. It is neither raster nor vector. In DT: Scan an existing product or a user's hand to measure it, then design around it. Find out more: Gaussian splatting (Wikipedia) ↗ Photogrammetry (Wikipedia) ↗ Ergonomics →
First step of a scan: the software works out where each photo was taken from (each pyramid is one camera). Image: Colin Kranz, CC BY-SA 4.0 (licence), via Wikimedia Commons
- One font file, with every style in between its extremes. Image: Stephen Nixon, SIL Open Font Licence (licence), via Wikimedia Commons Variable fonts One vector font file holds a whole family: sliders change the weight, width or slant smoothly, instead of needing a separate file for each style. In DT: Packaging and branding can use exactly the right weight of type, with smaller files. Find out more: Introducing variable fonts (Google Fonts) ↗
One font file, with every style in between its extremes. Image: Stephen Nixon, SIL Open Font Licence (licence), via Wikimedia Commons
- Resolutions drawn to scale: each newer standard packs in far more pixels. Image: TRauMa, CC0 (licence), via Wikimedia Commons High-resolution screens Phone screens now pack two or three screen pixels into every point you see, and HDR screens show brighter brights and deeper darks. In DT: Low-resolution raster images look blurry on these screens, while vector icons and text stay sharp: one more reason to use vectors where you can. Find out more: Pixel density (Wikipedia) ↗ HDR screens (Wikipedia) ↗
Resolutions drawn to scale: each newer standard packs in far more pixels. Image: TRauMa, CC0 (licence), via Wikimedia Commons
The 3D tools and machines on this site are drawn live in your browser by your graphics card, using WebGL: vector-style 3D models turned into pixels many times a second.
Key words
Pixel
One square of colour in a raster image (from "picture element").
Raster (bitmap)
An image stored as a grid of pixels.
An image stored as points, lines, curves and fills.
Resolution
How many pixels an image has, or how many fit in an inch (ppi / dpi).
Node (anchor point)
A point on a vector path where a line or curve starts or ends.
Bézier curve
A curve set by end nodes and handles (control points).
Z-order
The stacking order of objects, from back to front.
Boolean operations
Union, subtract, intersect and exclude: combining shapes into new ones.
Rasterise / trace
Turn a vector into pixels / turn pixels into vector paths.
See it in use: CAD/CAM → Laser cutter → Sketching →