PNG to SVG Converter

Trace PNG Images into Scalable Vector Graphics

Drop a PNG or JPEG imageOr, if you prefer...

About the PNG to SVG Converter

This PNG to SVG converter traces raster images into scalable vector graphics directly in your browser. It reads the image with a Rust-based pipeline compiled to WebAssembly, segments it into flat color regions, and emits a self-contained SVG document you can drop straight into a website, design tool, or icon set. Your image never leaves the device — every byte is processed locally.

The tool ships two tracing pipelines: a fast marching-squares tracer for line art and crisp shapes, and an enhanced Bézier-fitted tracer for photos, portraits, and organic illustrations. Twenty-one presets cover the common cases, and an Adjust toolbar lets you nudge the result without re-tuning every slider.

Key Features

How Does PNG to SVG Conversion Work?

The converter decodes your PNG or JPEG, reduces the palette with median-cut quantization, and traces each color region into closed contours. The basic pipeline emits straight line segments using marching squares. The enhanced pipeline runs an edge-preserving bilateral filter, builds edge-aware color masks, simplifies each contour with the Visvalingam–Whyatt algorithm, and fits cubic Bézier curves to the result. Both pipelines output a single SVG document with grouped paths, ready to use.

How to Convert PNG to SVG

  1. Drop a PNG or JPEG into the upload area, or click to browse.
  2. Pick a preset that matches your image type, or stay with the default.
  3. Switch the pipeline to Basic or Enhanced if needed.
  4. Click Convert. The first run downloads the WebAssembly tracer; subsequent conversions reuse it.
  5. Review the SVG preview, tweak sliders or use the Adjust toolbar, and re-convert until it looks right.
  6. Click Download SVG to save the result alongside your source file.

Choosing the Right Pipeline

The Basic pipeline runs faster, produces smaller files, and keeps corners crisp — ideal for line art, pixel art, screenshots, and flat illustration. The Enhanced pipeline costs more time and bytes but produces noticeably smoother curves on photos, portraits, logos, and anything organic. If a Basic result looks blocky, switch to Enhanced; if an Enhanced result looks bloated, try Basic with the same color count.

Common Use Cases

Parameter Reference

Every slider on the form maps to a single parameter on the underlying Rust pipeline. Knowing what each one does makes targeted tuning much faster than guessing.

Basic pipeline

Number of colors (num_colors · int · default 16)
How many colors the palette is reduced to via median-cut quantization. Lower values produce simpler, smaller SVGs but flatten gradients into bands. Higher values keep more color detail at the cost of file size and per-color path count. Try 2 for B&W, 8–12 for cartoons or logos, 24–32 for photos.
Threshold (threshold · float 0–1 · default 0.10)
Edge sensitivity used by the marching-squares contour tracer. Lower values pick up subtle edges (more shapes, more detail). Higher values ignore weak edges (cleaner output, fewer tiny regions). Drop this for dark or low-contrast images; raise it for bright or noisy ones.
Smooth level (smooth_level · int 0–10 · default 5)
Strength of Gaussian smoothing applied to contour points before path output. 0 keeps the raw stair-stepped pixel boundary (use for pixel art). 10 rounds aggressively, losing sharp corners. Mid-range (4–6) suits most photos.
Hierarchical (nest holes inside fills) (hierarchical · bool · default false)
When enabled, contours are organised into a parent/child hierarchy so nested shapes stack correctly (holes cut into outer fills). Helps for images with overlapping or enclosed regions; usually unnecessary for flat illustrations.

Enhanced pipeline

Number of Colors (num_colors · int · default 0 — auto)
0 auto-detects a palette size from the image's color complexity. Any positive value forces an exact count. Use a small value (2–4) to flatten illustrations; use a high value (24–48) to preserve photo gradations.
Curve Tolerance (curve_tolerance · float · default 2.0)
Maximum allowed deviation between the fitted cubic Bézier curve and the source contour, in pixels. Lower hugs the contour tightly (more curves, larger SVG). Higher permits looser fits (fewer curves, smaller SVG, smoother look). Try 1.0 for hi-fi photo, 2–3 for cartoons, 3.5+ for compact output.
Simplification Tolerance (simplification_tolerance · float · default 1.5)
Visvalingam–Whyatt point removal threshold. Lower keeps more polyline vertices before Bézier fitting (more faithful, more curves). Higher drops more "unimportant" vertices (cleaner, blockier). Pair with Curve Tolerance — both control fidelity from different angles.
Corner Threshold (deg) (corner_threshold · degrees · default 60)
Angle change above which a vertex is treated as a hard corner and preserved instead of smoothed. Lower (30–45°) keeps more sharp corners — good for line art and logos. Higher (75–90°) smooths through everything except dramatic angles — good for cartoons and photos.
Min Region Area (min_region_area · pixels · default 20)
Regions smaller than this many pixels are dropped before vectorization. Lower (1–5) keeps fine specks (detail-heavy work, hi-res inputs). Higher (40+) eliminates noise and tiny color islands (compact output, photos).
Edge Threshold (edge_threshold · int 0–255 · default 25)
Sobel edge magnitude cutoff used by the edge-aware quantizer. Lower respects subtler edges, keeping color boundaries near soft transitions. Higher only treats strong edges as boundaries. Lower this for dark images; raise it for bright or clean ones.
Smoothing Passes (smoothing_passes · int · default 2)
How many majority-vote passes are applied to the per-color binary masks before contour extraction. 0 preserves jagged edges. 1–2 denoises typical inputs. 3+ for very noisy photos at the cost of fine detail.
Smooth Window (smooth_window · int · default 3)
Window size (pixels) for boundary-point Gaussian smoothing. Works alongside Smoothing Passes but on the extracted contour rather than the mask. Larger windows produce softer, less faithful curves.
Preprocess (Bilateral Filter) (preprocess · bool · default true)
Run an edge-preserving bilateral filter before quantization. Smooths noise while keeping color boundaries crisp — essential for photos. Turn off for clean inputs (pixel art, line drawings, flat illustrations) where the filter would erase intentional detail.
Recolor from Source (recolor · bool · default true)
After regions are detected, sample the original image to assign each region a color from the source rather than from the quantized palette. On gives more natural-looking photo output. Off snaps to the quantized palette — better for posterized or logo-style results.

Tips for Better Results

Workflow

Image preparation

Tuning by image type

Reducing file size

Improving fidelity

Fixing black smudges or blotchy dark regions

When PNG to SVG isn't the right tool

Frequently Asked Questions

Is my image data safe when I convert PNG to SVG?

Every byte stays on your device. The WebAssembly tracer runs in your browser; the only network request the tool makes is to fetch the ~4 MB tracer module itself, and that happens after you click Convert. No image is uploaded.

Can I convert JPEG to SVG with this tool?

Yes. The accepted formats are PNG and JPEG. The same parameters and presets apply to both — JPEG just decodes one step earlier in the pipeline.

Why does the first conversion feel slow?

The first click downloads the WebAssembly tracer and initialises it. Subsequent conversions reuse the loaded module and run instantly up to the actual tracing time, which depends on image size and pipeline (usually 0.5–10 seconds).

Does the SVG keep transparency from the source PNG?

Mostly. The tracer treats transparent pixels as a separate region, so large transparent areas pass through. Soft alpha gradients are flattened during quantization, like any other gradient — you'll see bands rather than smooth fades.

How big can the input image be?

There is no hard limit, but conversion time grows quickly with image area, and the browser must hold the decoded pixels and tracing buffers in memory. For best results downscale to 1024–2048 px on the long side before converting.

What does "— custom —" mean in the preset dropdown?

It indicates that you have manually changed at least one slider since the last preset was applied. Selecting any named preset overwrites the form values; Custom is informational and cannot be applied.

Related Tools

You might also find these tools useful: