返回技能库

位图追踪到 SVG

使用 potrace/mkbitmap 将位图图像(PNG/JPG/WebP)追踪为干净的 SVG 路径。用于将徽标/轮廓转换为用于下游 CAD 工作流(例如 create-dxf 的 etch_svg_path)的矢量,并将参考图像转换为可制造的轮廓。

作者:ajmwagar · 最新版本:0.1.0

收藏:0 · 下载:1.6k

说明文档

# trace-to-svg

Convert a bitmap into a vector SVG using `mkbitmap` + `potrace`.

## Quick start

```bash
# 1) Produce a silhouette-friendly SVG
bash scripts/trace_to_svg.sh input.png --out out.svg

# 2) Higher contrast + less noise
bash scripts/trace_to_svg.sh input.png --out out.svg --threshold 0.6 --turdsize 20

# 3) Feed into create-dxf (example)
# - set create-dxf drawing.etch_svg_paths[].d to the SVG path `d` you want, or
# - store the traced SVG and reference it in your pipeline.
```

## Notes

- This is best for **logos, silhouettes, high-contrast shapes**.
- For photos or complex shading, results depend heavily on thresholding.
- Output is usually one or more `<path>` elements.