potrace
Trace bitmaps into vector graphics
TLDR
Convert bitmap to SVG
SYNOPSIS
potrace [options] [files]
DESCRIPTION
potrace transforms bitmap images into smooth, scalable vector graphics by tracing the boundaries between black and white regions. It uses an optimal polygon-fitting algorithm to produce clean curves, making it ideal for converting logos, line art, scanned drawings, and other high-contrast images into SVG, PDF, EPS, or PostScript format.
The tool accepts PBM, PGM, PPM, and BMP input formats. Tuning parameters control corner detection (alphamax) and speckle suppression (turdsize) to balance accuracy against smoothness. For photographs or color images, preprocessing with threshold or edge-detection tools is needed first.
PARAMETERS
-b, --backend format
Output format (svg, pdf, eps, ps).-s, --svg
SVG output.-e, --eps
EPS output.-p, --postscript
PostScript output.-o file
Output file.--invert
Invert input.-t, --turdsize n
Suppress speckles.-a, --alphamax n
Corner threshold.
EXAMPLES
potrace -s logo.bmp -o logo.svg
# PDF output with smoothing
potrace -b pdf --alphamax 1 image.bmp -o output.pdf
# Remove small spots
potrace -s --turdsize 5 noisy.bmp -o clean.svg
# From PNG (via conversion)
convert image.png image.bmp && potrace -s image.bmp
INPUT FORMATS
Accepts PBM, PGM, PPM, and BMP formats. Use ImageMagick or similar to convert other formats first.
CAVEATS
Works best on high-contrast images. Photos don't trace well. Input should be monochrome for best results.
HISTORY
potrace was written by Peter Selinger as an improved alternative to autotrace, using optimal polygon algorithms.
