Linux command
potrace 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Convert bitmap to SVG
potrace -s [input.bmp] -o [output.svg]
Convert to PDF
potrace -b pdf [input.bmp] -o [output.pdf]
Convert to EPS
potrace -e [input.bmp] -o [output.eps]
Invert colors
potrace -s --invert [input.bmp] -o [output.svg]
From PBM/PGM/PPM
potrace -s [input.pbm] -o [output.svg]
说明
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.
参数
- -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.
FAQ
What is the potrace command used for?
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.
How do I run a basic potrace example?
Run `potrace -s [input.bmp] -o [output.svg]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -b, --backend _format_ do in potrace?
Output format (svg, pdf, eps, ps).