How to convert a PNG or JPG to SVG
Updated
A PNG is a grid of pixels; an SVG describes shapes. Converting one into the other properly means tracing the image — finding its colour regions and drawing each as a path. Here is how tracing works, which images it suits, and how to get a clean result.
Beware the SVG that is still a PNG
Many converters take a shortcut: they put your PNG inside an SVG file as an embedded image and call it done. The file ends in .svg, but it is still a bitmap — it blurs when scaled, and nothing in it can be edited or recoloured. You can spot one by opening it in a text editor:
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512">
<image href="data:image/png;base64,iVBORw0KGgo..." width="512" height="512" />
</svg>A traced SVG contains <path> elements with fill colours instead — real shapes, sharp at any size.
How tracing works
- Colour reduction: the image is reduced to a small palette (2 to 64 colours), because every colour becomes its own set of shapes.
- Edge finding: the border of each region of one colour is followed pixel by pixel.
- Curve fitting: the jagged pixel borders are replaced with straight lines and smooth curves.
- Writing: each colour's outlines become a <path> with that fill.
Which images trace well
Tracing suits images that are already made of flat shapes: logos, icons, flat illustrations, line art, signatures, stamps and scanned drawings. Photos can be traced, but come out posterized — like a screen print — because a photo has smooth gradients and millions of colours that a handful of flat shapes can only approximate.
Start from the largest, cleanest version of the image you have. A blurry 64 px icon traces into blobs; the same logo at 1000 px traces into crisp curves.
The settings that matter
- Colours: as few as the artwork really has. A two-colour logo traced with 16 colours gets extra shapes for every anti-aliased edge.
- Black and white: for line art and scans, splitting pixels into ink and paper by brightness gives the cleanest outlines.
- Ignore specks: drops regions smaller than a few pixels — dust, noise and JPEG artefacts.
- Curve smoothing: higher values give fewer, rounder curves and a smaller file; lower values follow the pixels more closely.
- Soften first: a slight blur before tracing calms JPEG noise and texture.
Removing the background
A logo saved on a white background traces with a white rectangle behind it. Background removal makes the backdrop transparent before tracing. The good way to do it is a flood fill from the image's edges, so only the backdrop that touches the border goes; the same white inside the logo — a highlight, the counter of a letter — stays. A one-pixel clean-up of the blended edge avoids a light halo around the artwork.
After tracing
Compare the SVG with the original at a large size, then tidy up: optimize it to shorten the path data, recolour it to your brand colours, or crop the viewBox to the artwork. Detailed images can produce thousands of shapes — if the file is large, reduce the colours or raise the speck size and trace again.