From content-creation
Converts PNG images to high-quality SVG using ImageMagick, vtracer spline vectorization, and svgo compression. Supports optional white-background removal and parameter tuning for cleaner vectors.
How this skill is triggered — by the user, by Claude, or both
Slash command
/content-creation:png2svgThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
将 PNG 图片转换为高质量矢量 SVG,支持去除白色背景。
将 PNG 图片转换为高质量矢量 SVG,支持去除白色背景。
PNG → magick (去白底+alpha阈值) → vtracer (样条曲线) → svgo (压缩) → SVG
magick): 去除白色背景 + alpha 阈值处理当需要将 PNG 转换为 SVG 时,按以下步骤执行:
INPUT_PNG: 输入 PNG 文件路径(必需)OUTPUT_SVG: 输出 SVG 路径(默认:同名 .svg)KEEP_BG: 是否保留背景(默认:false,去除白色背景)如果需要去除背景(KEEP_BG=false):
magick INPUT_PNG \
-fuzz 15% -transparent white \
-channel A -threshold 50% +channel \
INPUT_PNG.temp.png
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 5
npx svgo OUTPUT_SVG -o OUTPUT_SVG --multipass
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 | 颜色精度 | 更准确 |
npx claudepluginhub lovstudio/skills --plugin generalCLI image manipulation using ImageMagick and vtracer — convert PNG/JPG to SVG, remove watermarks, resize, crop, and edit raster images.
Convert SVG to PNG with control over dimensions, background, CSS effects like mix-blend-mode/filters. Presets for app icons, favicons, splash screens.
Wraps raster logo files (webp, png, jpg) as base64-embedded SVG for pixel-identical output. Use when converting logos to SVG format without a vector source.