A command-line tool that converts PNG images to SVG.
It runs vtracer in an isolated subprocess by default, and falls back to a pure-Python tracer (built on numpy / scipy / scikit-image) when vtracer fails or times out, so a conversion never aborts because of one buggy input. Two-tone images (logos, icons, glyphs) are auto-detected and routed through an Otsu-thresholded fast path that avoids the usual halo / wavy-edge artifacts you get from K-Means on near-binary inputs.
- Python 3.10 or newer
- pip
- bash (the install scripts are bash scripts; on windows the bundled
install.batcalls into python directly, no bash needed)
Windows (PowerShell 5+):
git clone https://github.com/pnndrs/raster2vec.git C:\raster2vec; if ($?) { & "C:\Program Files\Git\bin\bash.exe" -lc "cd /c/raster2vec && ./scripts/install.sh" }
macOS / Linux:
git clone https://github.com/pnndrs/raster2vec.git ~/raster2vec && cd ~/raster2vec/scripts && chmod +x install.sh && ./install.sh
Clone or unzip the repo, then from the project root run one of:
- Windows:
scripts/install.bat - macOS / Linux:
scripts/install.sh
The installer removes any prior raster2vec install from every Python interpreter on your PATH (including stale wrapper scripts), then does a clean editable install from the current source. After it finishes, run raster2vec --version and confirm you see the build tag. If the build tag is missing, the install picked up an old copy somewhere and you should re-run the installer.
- Windows:
[path]/scripts/uninstall.bat - macOS / Linux:
[path]/scripts/uninstall.sh
This removes raster2vec from every Python interpreter on PATH and deletes any leftover raster2vec / raster2vec.exe shims.
raster2vec INPUT OUTPUT -W <width> -H <height> [options]
--width and --height are required and define the output viewBox.
Examples:
raster2vec logo.png logo.svg -W 1024 -H 1024raster2vec --helplists every flag.
MIT.