Converts single-color PNGs and SVGs with embedded PNGs into path-only SVG output using Potrace. Removes backgrounds automatically and preserves detailed line art, logos, and stamps.
Ships in utility-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Convert transparent or solid-background single-color artwork into a genuine SVG containing paths rather than an embedded bitmap.
Automatic tracing approximates the raster boundary. Only the original vector source can provide mathematically exact curves.
Supported:
Reject:
For multicolor artwork, recommend VTracer instead of forcing this workflow.
Important: All scripts are located in the scripts/ subdirectory of this skill.
Agent Execution Instructions:
SKILL_DIR.${SKILL_DIR}.bun ${SKILL_DIR}/scripts/vectorize.ts.${SKILL_DIR} with the absolute path.| Script | Purpose |
|---|---|
scripts/vectorize.ts | Extract alpha, scan Potrace candidates, measure error, and deliver the best path-only SVG |
scripts/vectorize.test.ts | Unit and real-toolchain regression tests |
Detect the runtime once per session:
command -v bun
command -v ffmpeg
command -v ffprobe
command -v potrace
command -v rsvg-convert || command -v inkscape
Required:
rsvg-convert from librsvg, or Inkscape.If a dependency is missing, install it directly with the available package manager. Report only when installation fails or no package manager is available.
Common macOS installation:
brew install oven-sh/bun/bun
brew install ffmpeg potrace librsvg
If Homebrew is unavailable, install with the platform package manager. Do not ask before installing missing conversion dependencies.
Confirm the input is within scope.
Run the converter:
bun ${SKILL_DIR}/scripts/vectorize.ts "/absolute/path/to/input.svg"
Read <source-slug>.report.json.
Confirm:
structure.pathCount >= 1;structure.imageCount === 0;structure.dataImageCount === 0;verified4x === true.backgroundRemoval.applied === true only when the input had a solid background.Inspect the PNG preview, especially fine lines, holes, hatching, and sharp corners.
Report the SVG, preview, selected threshold, MAE, RMSE, and IoU.
Choose the objective explicitly:
mae for the closest alpha appearance.iou for overlap, contour match, 轮廓重合率, or IoU requests.rmse only when large alpha errors matter more than average error.Never describe the result as lossless. Say “high-fidelity true vector” and include measured error.
Specify an output parent directory:
bun ${SKILL_DIR}/scripts/vectorize.ts input.png --output-dir ./output
Override the detected color:
bun ${SKILL_DIR}/scripts/vectorize.ts input.svg --color "#0113a8"
Use solid-background PNG directly; do not preprocess manually:
bun ${SKILL_DIR}/scripts/vectorize.ts "logo-on-white.png"
Preserve all threshold candidates for manual comparison:
bun ${SKILL_DIR}/scripts/vectorize.ts input.svg --keep-candidates
Temporary candidates are deleted by default. Keep them only when tuning, comparing versions, or resolving visual review disputes.
Advanced threshold control:
bun ${SKILL_DIR}/scripts/vectorize.ts input.svg \
--threshold-min 120 \
--threshold-max 140 \
--threshold-step 2
Validated defaults are 124..144, step 2, Potrace alphamax=0.2, and optimization tolerance 0.03.
Optimize for binary outline overlap and scan Potrace smoothing:
bun ${SKILL_DIR}/scripts/vectorize.ts input.svg \
--objective iou \
--threshold-min 122 \
--threshold-max 132 \
--threshold-step 1 \
--alphamax 0,0.2 \
--opttolerance 0,0.03
For detailed hard-edge art, alphamax=0 can raise IoU by avoiding curve smoothing. Do not hard-code color during experiments; inherit wrapper fill or use --color.
Single-file runs write directly into the chosen output directory:
<output-dir>/
├── <source-slug>.svg
├── <source-slug>.preview.png
└── <source-slug>.report.json
Default runs do not create candidates/. With --keep-candidates, also write all measured candidates:
<output-dir>/
├── <source-slug>.svg
├── <source-slug>.preview.png
├── <source-slug>.report.json
└── candidates/
├── candidate-t128-a0-o0.svg
├── candidate-t128-a0-o0.png
└── ...
If --output-dir is omitted, create <source-slug>-svg-output/ next to the input. Existing results are never overwritten; repeated runs append a timestamp to the output filename prefix. Do not copy the source file by default; the report records sourcePath.
For multiple input files, create one subdirectory per source under the chosen output parent to avoid collisions:
<output-parent>/
├── first-image/
│ ├── first-image.svg
│ ├── first-image.preview.png
│ └── first-image.report.json
└── second-image/
├── second-image.svg
├── second-image.preview.png
└── second-image.report.json
The report records backgroundRemoval when a pure-color background was converted to alpha. Intermediate PGM files remain temporary; candidate SVG/PNG files are preserved only with --keep-candidates.
Run:
bun test ${SKILL_DIR}/scripts/vectorize.test.ts
For final delivery, also validate the generated SVG:
xmllint --noout "/path/to/result.svg"
rg -o '<path\b|<image\b|data:image/' "/path/to/result.svg" | sort | uniq -c
The final SVG must contain paths and no raster references.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
vectorization, svg-conversion, potrace, image-tracing, png-to-svg
/utility-skills:daftai-image-to-svgfrom utility-skills
npx claudepluginhub daftai2026/daftai-skills --plugin utility-skills5 skills in this plugin
/daftai-chinese-copywritingChecks and fixes Chinese copywriting with autocorrect-backed workflows for text and single-file Markdown/TXT inputs. Use when user asks to normalize Chinese punctuation, spacing, or full-width/half-width usage. Also triggers for "校对", "检查排版", "中英文空格", "全角半角". Does not rewrite document structure, product claims, or UI messaging.
/daftai-chinese-technical-writingWrites, rewrites, and reviews Chinese technical documentation, product copy, and UI microcopy using ruanyf/document-style-guide, STE-inspired Chinese methods for procedural passages, and separate product and UI extensions. Use for 中文技术写作, README, API documentation, 操作指南, 安装部署说明, 故障排查文档, 运维 Runbook, 工具描述, Agent 指令文案, 产品介绍, 功能说明, 界面文案, 按钮, 空状态, and 错误提示 when the task concerns meaning, structure, or wording. Delegates requested formatting checks to daftai-chinese-copywriting. Pure punctuation or spacing tasks belong to that skill; personal essays and author-voice articles do not belong here.
/daftai-gpt-image-promptOptimizes natural-language image requests and rough prompts into ready-to-use GPT Image prompts using the official prompting guide as a live reference. Use when users ask to improve image prompts, 优化生图提示词, 把想法变成提示词, or write GPT Image generation, editing, vector, or animated-image prompts. Produces prompt text, not images, unless the user explicitly asks to generate.
Other plugins' skills for the same job