PNG or SVG? How tracing turns pixels into vector shapes

The difference between raster and vector images, how a tracer finds outlines, why smoothing makes files smaller, and when tracing a picture works well.

Open the Image to SVG Free, in your browser, nothing uploaded.

A PNG and an SVG can show the same logo, yet they are built in completely different ways, and that difference decides whether the logo stays sharp on a poster. This article explains raster and vector pictures, what a tracer does to get from one to the other, and how the Image to SVG settings change the result. It is for small businesses, students and makers who have a logo only as a picture file. Before tracing, crop and size the picture with the image resizer; afterwards, turn the vector into browser icons with the favicon maker, or pull its exact colours out with photo palette.

What it is

A raster picture is a grid of coloured squares. PNG, JPG and WebP files store one colour for every pixel. A 200 by 200 picture has 40,000 pixels, and at 4 bytes each (red, green, blue and see-through) that is 160,000 bytes before compression. Stretch it to twice the size and each pixel simply becomes a bigger square, so curves turn into steps.

A vector picture is a list of shapes. An SVG says “start here, draw a line to there, curve to there, close the shape, fill it black”. The browser draws those instructions fresh at any size, so the edge of a circle stays smooth whether it is 2 cm or 2 m wide.

Tracing is the bridge. The tool works in four stages:

  1. Sort the pixels. In black and white mode, any pixel darker than the cut-off becomes ink. In colours mode, the picture is cut down to a few colours with the median-cut method: it keeps splitting the group of colours along whichever channel (red, green or blue) varies most until there are as many groups as you asked for.
  2. Follow the edges. Wherever an ink pixel touches a non-ink pixel there is an edge. The tracer joins these edges into closed loops. A ring gives two loops: the outside and the hole.
  3. Tidy the loops. Loops smaller than the speck size are dropped. With smoothing on, each staircase edge is averaged into a gentle line, then the Douglas-Peucker method removes points that lie almost on a straight line between their neighbours.
  4. Write the SVG. Each colour becomes one <path>. The evenodd fill rule means a loop inside another loop is a hole, so the middle of an O stays empty.

How to use it

  1. Press Choose a logo or drawing and pick a JPG, PNG, WebP or GIF.
  2. Choose a Style: black and white for one-colour art, or several colours for flat illustrations.
  3. In black and white, move the Dark cut-off slider until thin strokes are caught but the background stays clean. In colours mode, set the Number of colours.
  4. Pick a Smoothness and a Detail size, and raise Ignore specks if a scan has dust.
  5. Compare “Your picture” with “The SVG”, and read the line underneath for the number of shapes, points and the file size.
  6. Press Download SVG or Copy SVG code.

A worked example

Take a round rubber-stamp logo drawn as a 200 by 200 pixel picture: a black ring with an outer radius of 80 pixels and a hole of radius 40 pixels.

  • The tracer finds 2 shapes: the outside loop covers 20,108 square pixels and the hole 5,024. Perfect circles would be π × 80² = 20,106 and π × 40² = 5,027, so the pixel version is within 3 square pixels of each.
  • With Exact pixel corners, the outlines need 560 points and the SVG is about 4.0 KB.
  • With Smooth, the same ring needs 72 points and about 2.4 KB; Smoother 52 points and 1.8 KB; Smoothest 40 points and 1.4 KB.

So smoothing cut the points by 93% (560 to 40) while keeping both shapes. Compare that with the raw pixel grid, 160,000 bytes: the vector is far smaller and has no fixed size at all.

Checked with the tools

The numbers above were worked out in Node with the tool’s own tracer, trace() in src/lib/image/trace.ts, on a ring drawn pixel by pixel the same way the tool’s test draws its ring. The script scripts/blog-figures/image-to-svg-guide.mjs then drew the same ring at sizes from 100 to 1,200 pixels and traced each one with three smoothness settings.

SVG size of a traced round stampSVG size of a traced round stamp0102002505007501e+31.25e+3Detail: picture side in pixelsSVG file size (KB)Exact pixel cornersSmoothSmootherfibub.com
File size of the SVG for the same ring drawn at different picture sizes, traced with three smoothness settings. Exact corners keep every pixel step, so the file grows with the picture; smoothing grows much more slowly. Our own test picture, traced with trace() from the tool.

The result explains the Detail setting. With exact corners the file grows in step with the picture, because every pixel step on the edge becomes a point: from 1.8 KB at 100 px to 27 KB at 1,200 px. Smoothed outlines grow far more slowly, reaching 6.3 KB (Smooth) and 4.5 KB (Smoother) at 1,200 px, because a circle needs only a few curves however big it is drawn.

Where it is used

  • Logos for print. Printers, sign makers and embroidery shops ask for vector files so the logo stays crisp at any size.
  • Cutting machines and laser engravers. Vinyl cutters and laser cutters follow paths, so a traced outline becomes the cut line.
  • Websites and apps. An SVG icon is small, sharp on high-resolution screens and can be recoloured with CSS.

Common mistakes

  • Tracing a tiny picture. A 64-pixel logo has too few pixels to describe its curves. Start from the biggest copy you have.
  • Expecting a photo to look like a photo. Soft shading becomes flat bands of colour. Tracing suits flat artwork.
  • Too many colours. Anti-aliased edges create in-between shades; asking for 16 colours turns them into thin slivers. Use as few colours as the art really has.
  • Leaving dust in. Scans pick up specks that become tiny shapes. Raise “Ignore specks” until they disappear.

Questions people ask

Why does my SVG look slightly rounder than the original? Smoothing averages each edge, which softens sharp corners a little. Choose “Exact pixel corners” for pixel art or crisp squares.

Is a bigger Detail always better? Only up to the quality of the source. Enlarging a small picture before tracing adds no new edges, just a bigger file.

Sources

  • SVG 1.1 path data (M, L, C, Z) and the evenodd fill rule are defined by the W3C SVG specification. Colour grouping uses the median-cut method (Heckbert, 1982); outlines are simplified with the Douglas-Peucker algorithm (1973). Checked 2026-12-05. fibub wrote its own tracing code.

If you are an author or publisher and want a credit or a passage changed or removed, tell us and we will act quickly.

Tools in this article

Read next