Raster vs vector: which one does your image need to be?
Pixels or paths? What each kind of image is good at, how to tell which one you have, and when it is worth converting one to the other.
Every image on a screen is one of two things: a raster image, which is a grid of coloured pixels, or a vector image, which is a list of shapes. Raster vs vector is not a contest. Each is right for different work, and most trouble comes from having the wrong one for the job in front of you.
What is a raster image?
A raster image stores a colour for every pixel. A photograph 4000 pixels wide and 3000 high holds twelve million of them. PNG, JPG, GIF and WebP are all raster formats.
Rasters are the natural form for anything a camera or scanner produces, because the world does not come in tidy shapes. Their weakness is size. A raster has exactly the detail it was saved with, so when you enlarge it the software has to invent pixels, and the picture goes soft or blocky.
What is a vector image?
A vector image stores instructions: draw a circle here with this radius, fill this outline with that blue, fade this shape from red to orange. SVG, PDF, EPS, AI and DXF are vector formats.
Because the file describes shapes and not pixels, it can be drawn at any size. A logo saved as a vector is as sharp on a billboard as on a business card. Vectors are also easy to change: you can pick up one shape and recolour or reshape it without touching the rest.
How do the two compare?
| Raster | Vector | |
|---|---|---|
| Made of | Pixels | Shapes and curves |
| Scales up | Blurs or shows pixels | Stays sharp at any size |
| Best for | Photographs, textures, screenshots | Logos, icons, type, diagrams, cutting paths |
| File size | Grows with dimensions | Grows with complexity |
| Common formats | PNG, JPG, GIF, WebP | SVG, PDF, EPS, AI, DXF |
| Edit by | Painting pixels | Moving points and changing fills |
How can I tell which one I have?
The file extension is the first clue, but it is not proof. An SVG or PDF can contain nothing but an embedded photograph. The reliable test is to zoom in a long way. If the edges stay crisp at 1600 %, it is a vector. If you start to see squares, it is a raster, whatever the file is called.
When do I need a vector?
You need a vector whenever the image will be reproduced at a size you cannot predict, or by a machine that follows lines:
- Printing a logo on signage, vehicles, clothing or packaging. Printers ask for vector artwork for good reason.
- Cutting and engraving. A laser cutter, vinyl plotter or CNC router follows paths. It cannot follow pixels.
- Icons and logos on websites. One small SVG is sharp on every screen, where a PNG needs several sizes.
- Editing. If you want to change one colour of a logo, a vector lets you.
When is a raster the better choice?
Keep photographs as rasters. A photograph has no shapes to describe, so turning it into a vector gives a posterised picture in a larger file. Screenshots, paintings and anything with fine texture are the same. If the picture only ever appears at one size on a screen, a well-made PNG or JPG is all it needs.
Can a raster be turned into a vector?
Yes, by tracing. A tracer looks at the pixels, finds the regions of colour and fits curves round them. Going the other way is trivial: any vector can be exported as a PNG at whatever size you like.
Tracing works well on images that were drawn as shapes in the first place: logos, icons, flat illustration, line art. How good the result is depends on the tracer. A careless one copies every pixel and returns hundreds of jagged shapes. A careful one recovers what was drawn: a circle as a circle, a fade as a gradient. That is the idea behind Rekha, and you can see traced examples in the gallery.
If you have a PNG or JPG that should have been a vector, convert the PNG to SVG or the JPG to SVG and compare the two side by side.
Common questions
Is SVG better than PNG?
For logos, icons and diagrams, yes: an SVG is usually smaller and is sharp at every size. For photographs, no. PNG and JPG are the right formats for those.
Does saving a PNG as SVG make it a vector?
Not by itself. Some programs simply wrap the PNG inside an SVG file, and it will still blur when enlarged. The pixels have to be traced into shapes.
Which vector format should I use?
SVG for the web and for editing. PDF or EPS for print. DXF for cutting machines and CAD. A good tracer writes all of them from the same trace.