
Lovstudio Png2svg
- 4 installs
- 2 repo stars
- Updated May 30, 2026
- lovstudio/png2svg-skill
Helps with ai & agent building tasks.
About
lovstudio-png2svg is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- lovstudio-png2svg
- AI & Agent Building
- AI-coding skill
Lovstudio Png2svg by the numbers
- 4 all-time installs (skills.sh)
- Ranked #13,372 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/lovstudio/png2svg-skill --skill lovstudio-png2svgAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 4 |
|---|---|
| repo stars | ★ 2 |
| Last updated | May 30, 2026 |
| Repository | lovstudio/png2svg-skill ↗ |
What it does
Helps with ai & agent building tasks.
Files
PNG to SVG Skill
将 PNG 图片转换为高质量矢量 SVG,支持去除白色背景。
工具链
PNG → magick (去白底+alpha阈值) → vtracer (样条曲线) → svgo (压缩) → SVG- ImageMagick (
magick): 去除白色背景 + alpha 阈值处理 - vtracer: 样条曲线矢量化(比 potrace 更平滑)
- svgo: SVG 路径压缩优化
调用方式
当需要将 PNG 转换为 SVG 时,按以下步骤执行:
输入
INPUT_PNG: 输入 PNG 文件路径(必需)OUTPUT_SVG: 输出 SVG 路径(默认:同名 .svg)KEEP_BG: 是否保留背景(默认:false,去除白色背景)
执行步骤
Step 1: 预处理(去白底)
如果需要去除背景(KEEP_BG=false):
magick INPUT_PNG \
-fuzz 15% -transparent white \
-channel A -threshold 50% +channel \
INPUT_PNG.temp.pngStep 2: 矢量化
vtracer --input INPUT_PNG.temp.png --output OUTPUT_SVG \
--mode spline \
--filter_speckle 8 \
--color_precision 8 \
--corner_threshold 120 \
--segment_length 6 \
--path_precision 5Step 3: 压缩优化
npx svgo OUTPUT_SVG -o OUTPUT_SVG --multipassStep 4: 清理
rm -f INPUT_PNG.temp.png输出
返回生成的 SVG 文件路径,并报告文件大小。
✓ PNG → SVG 转换完成
输入: {INPUT_PNG}
输出: {OUTPUT_SVG}
大小: {file_size}依赖
首次使用前确保已安装:
brew install imagemagick
cargo install vtracer
npm install -g svgo # 或使用 npx参数调优
| 参数 | 作用 | 调大效果 |
|---|---|---|
filter_speckle | 过滤小斑点 | 更干净 |
corner_threshold | 角点阈值 | 更平滑 |
segment_length | 线段长度 | 更平滑 |
color_precision | 颜色精度 | 更准确 |
Changelog for png2svg
[1.0.1] - 2026-05-07
Fixed
- standardize Agent Skills metadata and README
- expand trigger description and install documentation
v1.0.0 - 2024-12-24
- Initial release
- 工具链: ImageMagick + vtracer + svgo
- 支持去除白色背景(默认开启)
- 支持 --keep-bg 保留背景
- 支持自定义输出路径
Author: 公众号:手工川
lovstudio-png2svg
Convert PNG images into high-quality SVG files with optional white-background removal, vtracer spline vectorization, and svgo compression.
Part of lovstudio general skills — by lovstudio.ai
Install
npx lovstudio skills add png2svg -g -yDependencies
brew install imagemagick
cargo install vtracer
npm install -g svgonpx svgo also works when svgo is not installed globally.
Workflow
magick input.png -fuzz 15% -transparent white -channel A -threshold 50% +channel input.temp.png
vtracer --input input.temp.png --output output.svg --mode spline --filter_speckle 8 --color_precision 8 --corner_threshold 120 --segment_length 6 --path_precision 5
npx svgo output.svg -o output.svg --multipass
rm -f input.temp.pngOptions
| Variable | Default | Description |
|---|---|---|
INPUT_PNG | required | Source PNG path |
OUTPUT_SVG | input basename with .svg | Target SVG path |
KEEP_BG | false | Keep the original background instead of removing white |
License
MIT