vecto
Turn PNG, JPG and WebP images into clean, small SVGs, and find out how accurate each one is.
vecto traces logos, icons, signatures, line art, colour illustrations and pixel art. It also makes cut files for Cricut, Silhouette, laser cutters and plotters. You can use it as a CLI, a Python library, or an MCP server that AI assistants call directly.
- Presets instead of knobs. Pick
logo,signature,cut,pixeland so on instead of tuning potrace settings. - Every result is scored. vecto renders the SVG back to pixels and compares it with the source, so you can see how faithful the trace is.
--autotuning. It searches tracing settings for the smallest SVG that still matches the source.- Handles real inputs. It deals with transparent PNGs, light-on-dark images, tiny low-resolution logos, phone photos of signatures and dusty scans.
- No system dependencies. Every dependency installs from pip wheels on Linux, macOS and Windows. You don't need the
potracebinary or Cairo.
Examples
| Input | Command | Output (SVG) |
|---|---|---|
vecto convert logo.png -p logo --auto |
3.0 KB · fidelity 98.3% · edge error 0.24 px |
|
vecto convert signature.jpg -p signature |
3.3 KB · transparent · keeps the ink colour |
|
vecto convert art.png -p color |
2.3 KB · 6 colours · fidelity 99.6% |
|
vecto convert pixel.png -p pixel |
2.0 KB · pixel-exact |
|
vecto convert logo.png -p cut --outline |
cut lines for a laser or plotter |
The example inputs are synthetic and generated by examples/make_examples.py.
Install
vecto needs Python 3.12 or newer.
uv tool install git+https://github.com/hugoogb/vecto
You can use pipx instead:
pipx install git+https://github.com/hugoogb/vecto
To use the MCP server, install the mcp extra:
uv tool install "vecto-svg[mcp] @ git+https://github.com/hugoogb/vecto"
The package is called vecto-svg because vecto is already taken on PyPI. The command is still vecto.
For development:
git clone https://github.com/hugoogb/vecto && cd vecto
uv sync --all-extras
uv run pytest
Usage
Convert one image
vecto convert input.png # writes input.svg
vecto convert input.png out.svg -p logo # use a preset
vecto convert input.png --auto # smallest SVG that still matches
vecto convert input.png --preview # also writes out.preview.png
Each run prints a summary to stderr:
input.svg: 176.75x64, 3.0 KB, 1 paths, fidelity 98.3%, edge error 0.24px, 18 settings tried
Pipes and scripts
Use - for stdin or stdout. Add --json to get machine-readable results.
curl -s https://example.com/logo.png | vecto convert - -p logo > logo.svg
vecto convert logo.png logo.svg --json | jq '.fidelity, .bytes'
Convert a folder
batch accepts every convert option. Without --jobs it uses one worker per CPU. One broken file doesn't stop the batch: failures are listed at the end, and the exit code is non-zero if any file failed.
vecto batch ./images ./svgs -p icon --recursive --jobs 8
vecto batch ./scans ./out -p signature --skip-existing --json > report.json
Presets
Run vecto presets to list them:
| Preset | For |
|---|---|
logo |
Flat logos and wordmarks. Keeps the ink colour, smooth curves, tight crop. |
icon |
Small icons and glyphs. Upscales aggressively before tracing. |
signature |
Scanned or photographed signatures and handwriting. Handles uneven paper, removes dust, transparent background. |
lineart |
Ink drawings, sketches and comics in black and white. |
cut |
Cutting machines (Cricut, Silhouette, laser, plotter). One colour, no specks, simplified paths. Add --outline for stroke-only cut lines. |
color |
Colour illustrations, flat artwork and stickers. |
photo |
Photographs, with a posterised look. |
pixel |
Pixel art. Keeps hard square pixels. |
Any option you set overrides the preset. For example, -p cut --turdsize 5 keeps smaller details.
Fidelity and --auto
After tracing, vecto renders the SVG and compares it with the source.
- Mono results get two numbers:
- fidelity is the intersection-over-union of the ink pixels. Unlike plain pixel accuracy, it isn't inflated by empty background. Specks that were removed on purpose (see
--turdsize) don't count against it. - edge error is how far the outlines drift from the source, in pixels (99th percentile). Area scores barely notice rounded corners, but edge error does.
- fidelity is the intersection-over-union of the ink pixels. Unlike plain pixel accuracy, it isn't inflated by empty background. Specks that were removed on purpose (see
- Colour results get one number: 1 minus the mean colour difference.
--auto tries different curve-fitting settings (alphamax and opttolerance for mono, colors and layer_difference for colour). It keeps the smallest file that meets --target (default 0.95 mono, 0.98 colour) and, for mono, --max-edge (default 0.5 px). If no setting qualifies, it returns the most faithful result with a warning. Noise filtering is never auto-tuned. A search that rewards fidelity would always choose to keep the dust.
Use from Python
from vecto import vectorize, build_options
result = vectorize("logo.png", build_options("logo"), auto=True)
print(result.fidelity, result.edge_error, result.bytes)
open("logo.svg", "w").write(result.svg)
# numpy arrays (RGB, RGBA or greyscale) and raw bytes work too
result = vectorize(image_array, build_options("cut", turdsize=10))
Use from AI assistants (MCP)
vecto mcp starts a stdio MCP server with two tools: vectorize_image and list_presets. The tool returns fidelity, size and warnings, so an agent can check the result instead of guessing.
To add it to Claude Code:
claude mcp add vecto -- uvx --from "vecto-svg[mcp] @ git+https://github.com/hugoogb/vecto" vecto mcp
For Claude Desktop, Cursor and other MCP clients, add this to the MCP config:
{
"mcpServers": {
"vecto": {
"command": "uvx",
"args": ["--from", "vecto-svg[mcp] @ git+https://github.com/hugoogb/vecto", "vecto", "mcp"]
}
}
}
Options
| Option | Default | Description |
|---|---|---|
-p, --preset |
none | Start from a preset (see above). |
-m, --mode |
mono |
mono traces one colour with potrace. color traces colour layers with vtracer. |
--auto |
off | Search for the smallest SVG that meets --target and --max-edge. |
--target |
0.95 / 0.98 | Fidelity goal for --auto. |
--max-edge |
0.5 | [mono] Maximum edge drift for --auto, in pixels. |
-t, --threshold |
auto (Otsu) | Cut-off between ink and background (0–255). |
--adaptive |
off | Local thresholding, for shadows and uneven paper. |
--invert / --no-invert |
auto | Swap ink and background. By default, dark backgrounds are detected automatically. |
--blur |
3 | Denoising blur before thresholding (0 turns it off). |
-u, --upscale |
auto | Enlarge the image before tracing. By default, small anti-aliased mono images are upscaled up to 4×. |
--crop / --no-crop |
off | Trim empty margins. |
--padding |
0 | Margin kept around cropped content, in pixels. |
-c, --color |
auto |
Mono fill colour. auto keeps the source's ink colour. |
-b, --background |
none | Add a solid background. Output is transparent by default. |
--outline / --fill |
fill | Draw strokes instead of filled shapes. |
--stroke-width |
1 | Stroke width for --outline, in pixels. |
--turdsize |
5 | [mono] Remove specks up to this area, in pixels. |
--alphamax |
0.9 | [mono] Corner smoothing, from 0 (sharp) to 1.334 (round). |
--opttolerance |
0.2 | [mono] How aggressively curves are merged. |
--colors |
6 | [color] Colour precision in bits per channel (1–8). |
--filter-speckle |
4 | [color] Discard patches smaller than this. |
--layer-difference |
16 | [color] Minimum colour difference between layers. |
--trace-mode |
spline |
[color] spline, polygon, or none (pixel-exact). |
--optimize / --no-optimize |
on | Minify the SVG with Scour. |
--preview |
off | Also write a PNG rendering of the result. |
--json |
off | Print machine-readable results. |
-q, --quiet |
off | Only print errors. |
How it works
- Load. Pillow reads the image, with EXIF rotation, 16-bit images and transparency all handled. Transparent images are composited onto whichever background contrasts with the content, so both dark and light logos on transparency come out right.
- Prepare (mono). vecto converts to greyscale and upscales small images, but only anti-aliased ones, where there's sub-pixel detail to recover. It then blurs lightly, thresholds (Otsu, manual or adaptive), detects a dark background, and optionally crops.
- Trace. Mono images go through potrace (pure-Python
potracer). Colour images go throughvtracer. - Optimise. Scour minifies the SVG. The output keeps the source's pixel dimensions, plus a
viewBox. - Score. resvg renders the result, which is compared against the source (see Fidelity above).
License
Metadata
Release files for vecto-svg 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vecto_svg-0.2.0.tar.gz | 124.2 kB | Without provenance | Details for vecto_svg-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vecto_svg-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for vecto_svg-0.2.0-py3-none-any.whl |
Total release size: 149.6 kB
Release files / vecto_svg-0.2.0.tar.gz
| Download URL | vecto_svg-0.2.0.tar.gz |
|---|---|
| Size | 124.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80e0bc4f6fa2d5a50065ccd23347c147155cbb8405172e96ab5e8f849153bfbb
|
|
BLAKE2b-256 checksum How to use checksums |
a457094eeab7e02ee719646b0f11473bfee2d31c6062d8fc805329bf31e50181
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / vecto_svg-0.2.0-py3-none-any.whl
| Download URL | vecto_svg-0.2.0-py3-none-any.whl |
|---|---|
| Size | 25.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa98102c44fa8718b7e5d7deefd5d277538f177711ff5739fda2a2fba5639a4a
|
|
BLAKE2b-256 checksum How to use checksums |
fd88360929371dd8b353efa0f4acfa1eaed1308774fdb27765016f79b774a1fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for vecto-svg 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.