Converts raster images into SVG with Potrace. Ships in two forms:
web/— browser app, deployable to Netlify. Runs entirely client-side (Potrace compiled to WebAssembly); no server, no uploads.- root Python — CLI and Tkinter GUI driving the native
potracebinary.
Both share the same pipeline; the web version is a port of the Python one and produces equivalent output.
The repo is deploy-ready — netlify.toml at the root already points at web/:
base = "web", command = "npm run build", publish = "dist"- Connect the repository on Netlify (or run
netlify deploy --prod). - No environment variables, no build plugins, no functions. Netlify runs
npm run buildinsideweb/and serves the staticdist/.
Netlify has no Python runtime and no potrace binary, so the web app is not a
wrapper around the CLI: the whole pipeline (resampling, denoise, quantization,
tracing) was reimplemented in JavaScript + WebAssembly and runs in the visitor's
browser. Nothing is uploaded anywhere — the CSP in netlify.toml sets
connect-src 'none', so the browser itself enforces that.
cd web
npm install
npm run dev # http://localhost:5173
npm run build # -> web/dist
npm run preview # serve the production build- Work happens in Web Workers, several images in parallel; batch results
download as a
.zip. - Supersampling multiplies the traced area by
s². Above ~12 Mpx the factor is reduced automatically to keep the tab from running out of memory. - Speed is dominated by Potrace, which traces one layer per color. A 1200×900
photo at 16 colors takes roughly 12 s; lowering
colorsor settingsupersampleto 1 makes it several times faster. - Transparent PNGs are flattened onto white by default. Without that, dropping the alpha channel (what Pillow does) turns transparent areas into pure black and buries the trace under a black rectangle.
- Python 3.10+
potraceon yourPATH— macOS:brew install potrace
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txtGUI — add files or a whole folder, pick the output folder, click vectorize:
./vetorizar.sh gui # or: python3 gui.pyCLI:
python3 cli.py --input ./photo.png --output ./out/photo.svg # single
python3 cli.py --input ./images --output ./out # folderUseful options:
--colors 16— color vectorization;0= black and white.--threshold 160— binarization (0–255); lower = more black.--invert— invert binarization (if the trace comes out negative).--turnpolicy minority— potrace turn policy (seepotrace -h).
Input: anything Pillow can open (PNG/JPEG/WebP/TIFF…). Output: SVG from potrace.
Potrace is GPL-2.0, and so is the WebAssembly build bundled into the web app
(esm-potrace-wasm). Distributing the built site therefore distributes GPL-2.0
code — keep the corresponding source available.