From content-creation
Converts PNG images to high-quality SVGs: removes white backgrounds with ImageMagick alpha thresholding, vectorizes using vtracer spline curves, compresses with SVGO. Ideal for creating clean vectors from raster graphics.
npx claudepluginhub lovstudio/skills --plugin content-creationThis skill is limited to using the following tools:
将 PNG 图片转换为高质量矢量 SVG,支持去除白色背景。
Converts PNG/JPG to SVG using vtracer, removes watermarks, resizes, crops, and edits raster images with ImageMagick CLI commands. Useful for preparing images in docs, diagrams, or code assets.
Convert SVG to PNG with control over dimensions, background, CSS effects like mix-blend-mode/filters. Presets for app icons, favicons, splash screens.
Generates and edits SVG logos, icons, and graphics. Covers path commands, shape primitives, styling, accessibility, gradients, masks, sprites, optimization, and animation techniques like CSS keyframes and SVG-specific methods.
Share bugs, ideas, or general feedback.
将 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 | 颜色精度 | 更准确 |