This release is a pre-release and may not be stable for production use.
vtracer (Python)
Python bindings for vtracer. Built
with pyo3 + maturin; the core Rust
crate stays pure (no I/O), and this crate adds image decoding and a Pythonic API.
Introduction
visioncortex VTracer is an open source software to convert raster images (like jpg & png) into vector graphics (svg). It can vectorize graphics and photographs and trace the curves to output compact vector files.
Comparing to Potrace, VTracer has an image processing pipeline which can handle colored images. VTracer skips Potrace's expensive optimal-polygon search in favor of a fast, linear pipeline that stays faithful to high-resolution images.
Comparing to Adobe Illustrator's Image Trace, VTracer's output is much more compact as we adopt a stacking strategy and avoid producing shapes with holes.
VTracer is originally designed for processing high resolution scans of historic blueprints up to gigapixels. At the same time, VTracer can also handle low resolution pixel art, simulating image-rendering: pixelated for retro game artworks.
Technical descriptions of the tracing algorithm and clustering algorithm.
Install
pip install vtracer==1.0.0a4
Usage
import vtracer
# one-liners
vtracer.convert_file("in.png", "out.svg")
svg = vtracer.convert_bytes(open("in.png", "rb").read()) # -> str
svg = vtracer.convert_pixels(rgba_bytes, width, height) # raw RGBA8
# a rich, reusable configuration object
cfg = vtracer.Config(mode="polygon", filter_speckle=8)
cfg.hierarchical = "cutout" # seam-free mosaic
cfg.palette = ["#1b1b1b", "#e0c088", "#5a7d3c"] # snap to a fixed palette
cfg.max_colors = 8 # or auto-quantize
cfg.optimize = 2
svg = cfg.convert_bytes(data)
# presets
vtracer.Config.poster().convert_file("photo.jpg", "poster.svg")
vtracer.Config.bw().convert_file("scan.png", "lineart.svg")
Config
Constructor keyword arguments (all optional) — also exposed as mutable
properties, plus the presets Config.bw(), Config.poster(), Config.photo():
| arg | default | notes |
|---|---|---|
clustering |
"color-cluster" |
"color-cluster", "bw", or "watershed" |
hierarchical |
"stacked" |
"stacked" or "cutout" (mosaic) |
mode |
"spline" |
"pixel", "polygon", "spline" |
filter_speckle |
4 |
discard patches smaller than X px |
color_precision |
6 |
significant bits per channel |
layer_difference |
16 |
color diff between gradient layers |
corner_threshold |
60 |
degrees |
length_threshold |
4.0 |
px |
max_iterations |
10 |
|
splice_threshold |
45 |
degrees |
simplify |
None |
curve simplification tolerance in px (try 1–2.5) |
path_precision |
2 |
output decimal places |
palette |
None |
list of #rrggbb strings |
max_colors |
None |
auto-quantize target |
optimize |
1 |
0 off, 1 quantize+cleanup, 2 + shorthands |
binary_threshold |
128 |
bw: fixed cutoff, foreground below it |
adaptive |
False |
bw: Bradley–Roth adaptive thresholding |
adaptive_window |
0 |
bw adaptive: window px (0 = auto) |
adaptive_t |
15.0 |
bw adaptive: % below local mean |
watershed_detail |
128 |
watershed: hierarchy cut level (higher = more regions, uncapped) |
Each Config has convert_file(input, output), convert_bytes(data, format=None) -> str,
and convert_pixels(rgba, width, height) -> str.
Build from source
maturin develop # into the active virtualenv
maturin build --release # produce a wheel
Metadata
Release files for vtracer 1.0.0a4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vtracer-1.0.0a4.tar.gz | 102.3 kB | Details |
Built distributions (wheels)
Total release size: 18.2 MB
Release files / vtracer-1.0.0a4.tar.gz
| Download URL | vtracer-1.0.0a4.tar.gz |
|---|---|
| Size | 102.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ffa459c2c56fe97814f228340db270faa04397f1400b2f37391c096e45063a4
|
|
BLAKE2b-256 checksum How to use checksums |
8d144ccb9d950fb72d0ea2990e8c8e0f8d76b3a40bf58329892d46754d314296
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-win_arm64.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-win_arm64.whl |
|---|---|
| Size | 896.1 kB |
| Tags | CPython 3.8 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
38963a75bc7bbdffaa5a98ac879502ef7db850af9511eb4a7ab30a90d98f8bac
|
|
BLAKE2b-256 checksum How to use checksums |
9be4cd4520bf097c0443b002901c5a208caee2cce230a417f9deda0a49dd38cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-win_amd64.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 954.6 kB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
fd371f385ab406101abb560651e936ce915aa05e1ec4cb691c2855920d838086
|
|
BLAKE2b-256 checksum How to use checksums |
fb80943ef374df4bd316de49d09dd3af26cfc9d03f0f6aa78299214c9a5f2938
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-win32.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-win32.whl |
|---|---|
| Size | 923.0 kB |
| Tags | CPython 3.8 Windows x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
7dc27d903a7a886a03ee5cd4ddee8de2cb575898bbc727a2f84b2febea46c024
|
|
BLAKE2b-256 checksum How to use checksums |
b561259fce28f325ec571e938a38bba969ae3c793a24d967160420db83f76794
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-musllinux_1_2_x86_64.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.8 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ad61c01306d18711a6891d420c8deb3d3cce644003aabc5013ebd6eab9764761
|
|
BLAKE2b-256 checksum How to use checksums |
86ba21f784af85e5e8abb35290465223a63eb31826e0e097fc46b1fce7df7178
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-musllinux_1_2_i686.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-musllinux_1_2_i686.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.8 Linux musl 1.2+ x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
eb400681a7527d3cf3182499dadc702094cad4e7b9575f510d86c43cf3e20ad8
|
|
BLAKE2b-256 checksum How to use checksums |
0bbb4ae6245f2fc6b5b69f3c4819f2d69b1a760fd1548fb5415cf78cdddfb98c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-musllinux_1_2_armv7l.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-musllinux_1_2_armv7l.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.8 Linux musl 1.2+ ARMv7l abi3 |
|
SHA-256 checksum How to use checksums |
315e0ecba223a8ede9dedbc280fd6296e94cd70336000df505793c858cd42dd6
|
|
BLAKE2b-256 checksum How to use checksums |
66672ea131563cb34a5fec6d8b9c2ee904d8ea39af85226e47e822c492fd02c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-musllinux_1_2_aarch64.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.8 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
d7a15af70cce826b7282ee337f4752e84877eeb87237a338ffca6d132454bd92
|
|
BLAKE2b-256 checksum How to use checksums |
861eb84ef4cb2729e79b6fe4bea27839be411e60c69aa9423a80a92b1d182c8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
94fb2737bce7d66f82981de25cf9fd38685f02c5a0399354e536837c501a6007
|
|
BLAKE2b-256 checksum How to use checksums |
e1e076ae3df590cd2235cf9b0823bc28c87aa3a5fc69eb32942393f92d9a9b17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ IBM System/390x abi3 |
|
SHA-256 checksum How to use checksums |
1e6a588bce68d5749fb27d65285665317732477d8e87b05d6831532f8f9aa8ab
|
|
BLAKE2b-256 checksum How to use checksums |
dbba5072dbb5a8834215e7412d86f02210df2329f5536a19e9c74af4539e9726
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ PowerPC 64-le abi3 |
|
SHA-256 checksum How to use checksums |
c7aff68fac871cfb11a73b95bce295c10f92f172ab54f253a23a8890b15c9d3a
|
|
BLAKE2b-256 checksum How to use checksums |
7f5361fa93c0abc8622ffb89438e57c1d1f0c514d53a4f38b6a3027689cd5dc9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARMv7l abi3 |
|
SHA-256 checksum How to use checksums |
809cf080bd944fa9338559a57b2fe194f49e4ded3a6208a0a1ecc28d1cdc80aa
|
|
BLAKE2b-256 checksum How to use checksums |
9c43bb103c5930e2f069e394dd2247ac2ac7e9c86cda8803061fae23773cea98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
c8c778572d853910e80798a1cc4ae2057c7171962643eedf86fc39b3bfde1f75
|
|
BLAKE2b-256 checksum How to use checksums |
45d9a39e4bf305af628d6cae423ba1cafacafb43fa2086d26403da1605afbfa9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.8 Linux glibc 2.5+ x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
eeb1da0142c737c4b9fbcd816d8518a0918c9fe568089a208edc3c71190f4595
|
|
BLAKE2b-256 checksum How to use checksums |
c71fbb4216432cf3d1ffbe360c0b941522821e5ff816789c2a7ba19c3f3f2ac8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d120dcee58ec8c92a303b46d3cb141c9bdb891dc2234bebf67373e130fd2f974
|
|
BLAKE2b-256 checksum How to use checksums |
46a27cdcdb6f5daeeafffd3cfad9daa0f6c6f897c169bb110f267c827c4be3a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / vtracer-1.0.0a4-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | vtracer-1.0.0a4-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
636aeeeee24aea6dc071e08b3dc6d9379faaa524ef55a4ee20728d68d85de7ab
|
|
BLAKE2b-256 checksum How to use checksums |
e01ad46b31a9f08f1f34e0b16cd74662e95d78e90b746f9e88098aa373d2668a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|