Browser-based image tool · JPG, PNG, WEBP → SVG

Image to SVG

The picture is reduced to the number of colours you choose, and the outline of every patch of each colour is traced into a vector path. The result scales to any size without blurring. Tracing happens in this browser tab.

Input

One image at a time, up to 25.00 MB and 50 megapixels.

Made for flat logos, icons and simple drawings with a few solid colours. A photograph has thousands of shades, so it turns into a blotchy poster with a very large file, not a faithful copy.

Drop an image here or click to choose

.jpg, .jpeg, .png, .webp

SVG

Transparent areas show as a checkerboard.

Add an image to see its SVG trace here.

Image to SVG

Operator: Abdulla Al Fahad. How tools are built and checked

A bitmap logo has a fixed number of pixels. Blow a 300-pixel PNG up for a shop sign or a vinyl cutter and every edge turns into a staircase. An SVG describes the same shapes as outlines with coordinates, so a browser, a print shop or a plotter can draw them at any size. Image to SVG makes that outline version from a PNG, JPG or WEBP by tracing the colour patches in the picture.

It is built for flat artwork: logos, icons, stamps, simple badges, line drawings and cartoon shapes with a handful of solid colours. It is not built for photographs. A photo of a face or a landscape contains thousands of subtly different shades, and squeezing those into twelve flat colours gives a posterised picture whose SVG can easily end up heavier than the original JPG.

Key features

  • Colour reduction to anywhere from 2 to 12 colours, chosen from the opaque pixels only
  • Pixel-edge boundary tracing with holes kept, so the counter of an O or the gap in a ring stays open
  • Ramer-Douglas-Peucker simplification with a tolerance from 0 to 4 pixels
  • Optional removal of the border colour, leaving the background transparent
  • Live preview on a checkerboard with the SVG size in kilobytes, the path count and the point count
  • A cap of 200,000 points, with a notice when the smallest shapes had to be left out

What changes between PNG, JPG or WEBP and SVG

Input is JPG, PNG or WEBP, recognised from the first bytes of the file rather than its name. Files over 25 MB or 50 megapixels are refused before the browser decodes them. Pictures above 4 megapixels are scaled down for tracing, and the coordinates are scaled back up, so the SVG keeps the original width and height in its viewBox.

The SVG contains one <path> element per colour, each with fill-rule="evenodd" and a hex fill. Colours are stacked from the one covering the most pixels at the bottom to the one covering the fewest at the top, and each layer also covers the area of every colour above it. That overlap is deliberate: when an outline is smoothed, the colour underneath shows through instead of a transparent crack.

Outlines are made of straight segments only. There are no Bézier curves, strokes, gradients, groups or text, so a circle comes out as a many-sided polygon whose corner count depends on the simplify setting. Pixels whose alpha is below 128 (out of 255) count as transparent and get no path; soft, half-transparent edges therefore become hard edges.

How it works

First the opaque pixels are grouped into a colour histogram and split by median cut, the classic method that keeps dividing the colour range with the most spread until there are as many groups as you asked for. A few rounds of k-means then move each colour to the true centre of its group, and every pixel is labelled with the nearest one.

Next, for each layer, the tracer walks along the edges between pixels that are in the layer and pixels that are not, joining them into closed loops. Outer edges run clockwise and holes run anticlockwise, which the evenodd fill rule turns back into shapes with holes. Two pixels that touch only at a corner are traced as separate shapes.

Finally each loop is simplified: Ramer-Douglas-Peucker keeps a point only when removing it would move the outline further than the tolerance. Loops enclosing fewer than 2 pixels are dropped as specks before the SVG text is written.

Common use cases

  • A bakery has its logo only as a 400 × 400 PNG from an old website and needs a version the sign maker can enlarge to a metre wide.
  • A crafter wants a two-colour badge as an SVG for a cutting machine, which follows path outlines rather than pixels.
  • A developer needs an inline SVG of a simple app icon so it can be recoloured with CSS instead of shipping several PNG sizes.
  • A club secretary has a scanned black-on-white crest and wants a clean outline for embroidery quotes, accepting that fine hatching may need manual tidying.
  • A teacher turns a flat clip-art shape into SVG so it stays sharp when projected on a large classroom screen.

How to use this tool

  1. Drop a PNG, JPG or WEBP onto the input area, or click it to choose a file.
  2. Move the Colours slider to the number of colours in the artwork, including the background.
  3. Adjust Simplify until the edges look smooth in the preview without rounding off corners you need.
  4. Tick Leave the background empty if the SVG should be transparent around the artwork.
  5. Check the size readout and the swatches, then click Download SVG.

Example

Input: a 120 × 120 PNG with an anti-aliased red (#DC1E28) circle of radius 40 px centred on a white background

Colours: 2 · Simplify: 1 px · Leave the background empty: off

Output: an SVG with viewBox="0 0 120 120", 361 bytes

Two paths. The bottom one, #FFFEFE, is a 4-point square covering the whole image; the top one, #DC1F29, is a 24-point polygon enclosing about 5,074 square pixels, against 5,027 for a perfect circle of that radius. With simplify at 0 the same trace needs 192 points and 1,345 bytes; at 3 px it drops to 16 points and the circle visibly becomes a twelve-sided shape. Ticking Leave the background empty removes the white square and leaves one red path in 289 bytes. Raising the colours to 6 on the same image produced a third, pink colour from the anti-aliased edge and 22 shapes instead of 2.

Tips for best results

  • Set the colour count to the number of inks you can see, background included. A red mark on white is 2; a blue and yellow badge on white is 3.
  • Start with simplify at 1 px. Drop to 0.5 px for small lettering whose corners matter, and raise it to 2 or 3 px for big bold shapes where file size matters more than exact corners.
  • Use the largest, cleanest copy of the artwork you have. A 1,000-pixel PNG traces into smoother outlines than a 64-pixel favicon, because the tracer can only follow detail that exists in the pixels.
  • Tick Leave the background empty when the SVG has to sit on a coloured page. The colour covering at least half of the image border is left out, and the swatch list tells you which one it was.
  • If a brand colour comes out a shade off, open the .svg in a text editor and replace the hex value in that path's fill attribute; there is exactly one fill per colour.

Edge cases to watch

Anti-aliasing is the most common surprise. The soft pixels along each edge sit between two colours, and when the colour count is set higher than the artwork needs, those in-between shades get colours of their own and appear as thin halos around every shape.

Palette colours are averages of the pixels assigned to them, so a pure white background mixed with a few pinkish edge pixels can come out as #FFFEFE instead of #FFFFFF. On screen the difference is invisible; in a print workflow that matches exact values, correct it by hand.

JPG compression adds blocky noise around edges. Tracing a JPG logo at a high colour count picks that noise up as specks, so prefer a PNG source where you have one.

Common errors and how to fix them

The message "IMG_2041.heic" is a HEIC photo. Only JPG, PNG and WEBP files can be traced appears under the drop zone.
The tracer checks the first bytes of the file before decoding and accepts only JPG, PNG and WEBP signatures, so a HEIC photo is refused even when renamed to .png. Export a PNG from your photo app (PNG keeps edges free of JPG noise) and drop that instead.
A notice says the trace passed 200,000 points and the smallest shapes were left out.
The picture has more detail than flat artwork usually does, often because it is a photo or a noisy scan. Lower the colour count or raise Simplify; both cut the number of points.
The preview shows thin coloured rings around every letter.
The colour count is higher than the artwork needs, so edge shades got their own colour. Lower the Colours slider one step at a time until the rings disappear.
Leave the background empty is ticked but the background is still filled.
No single colour covers at least half of the image border, for example because the artwork touches the edges. Crop some margin around the logo, or leave the option off.

Best practices

  • Trace from the original artwork export where possible, not a screenshot that has been resized or compressed.
  • Zoom into the downloaded SVG in a browser at 400% or more before sending it to print; small notches that are invisible at normal size show up there.
  • Keep the colour count as low as the design allows. Every extra colour adds a full layer of outlines to the file.
  • For lettering that must be exact, use the trace as a base and redraw critical words in a vector editor with the real typeface.

Why a traced logo is not the same as the original vector file

Tracing guesses the shapes from pixels; it cannot recover what the designer drew. A curve in the original file was one smooth Bézier segment. The trace sees a staircase of pixels and approximates it with straight lines, so a circle becomes a polygon and a sharp serif may be nicked or rounded depending on the simplify setting.

If the business that owns the logo, or the designer who made it, still has the AI, EPS, PDF or SVG master, that file will always beat a trace. Use this tool when the bitmap is genuinely all that is left, or when a close approximation is good enough for the job.

Reading the size and point counts

The readout above the preview shows the SVG size in kilobytes, the number of paths (one per colour), the number of separate shapes, and the total number of points. The point count is the best predictor of how heavy the file will be and how fast it will draw.

The red circle in the worked example needs 28 points in total. A count in the tens of thousands means the tracer is following noise, gradients or photographic texture, and the result will look worse than the source, not better.

  • Few points, few shapes: flat artwork, a good candidate for tracing.
  • Many tiny shapes: compression noise or anti-aliasing halos; lower the colour count.
  • Cap notice shown: photographic content; this tool is the wrong choice for that image.

Frequently asked questions

Why does my photo look like a poster after tracing?

Every pixel has to be assigned to one of at most 12 flat colours, so smooth gradients such as skin, sky or shadows break into bands with hard edges. That is inherent to colour tracing. Keep photographs as JPG or WEBP and use this tool for flat graphics.

Does it produce curves or only straight lines?

Only straight line segments. At a simplify value of 1 px the segments are short enough that edges look smooth at normal sizes, but a vector editor will show them as polygons, not as Bézier curves.

How are transparent parts of a PNG handled?

Pixels with an alpha value below 128 are treated as empty and get no path, so a logo on a transparent background traces with a transparent background. Partly transparent edge pixels at or above that threshold are treated as solid.

Can I edit the SVG afterwards?

Yes. Each colour is a single path element with a plain hex fill, so changing a colour is one edit in any text editor, and vector editors can split a path into its separate shapes for further work.

What happens to the pixels while the image is traced?

The image is drawn once onto a canvas in this tab and its pixels are copied into an RGBA buffer held by the page. The palette, outlines and SVG text are all computed from that buffer by the page's own JavaScript, and the finished SVG is wrapped in a Blob that the preview and the Download button point to through a local blob: URL. No part of the image or the SVG is sent anywhere.