{"id":"6a3ca52c-6ef8-489a-9bde-22fd140221dc","shortId":"WunEDG","kind":"skill","title":"lovstudio-png2svg","tagline":"Convert PNG images to high-quality SVG with optional white-background removal, vtracer spline vectorization, and svgo compression. Use when the user asks for \"PNG to SVG\", \"png2svg\", \"转 SVG\", \"矢量化\", \"去白底\", logo tracing, or converting raster icons into editable vector assets.","description":"# PNG to SVG Skill\n\n将 PNG 图片转换为高质量矢量 SVG，支持去除白色背景。\n\n## 工具链\n\n```\nPNG → magick (去白底+alpha阈值) → vtracer (样条曲线) → svgo (压缩) → SVG\n```\n\n- **ImageMagick** (`magick`): 去除白色背景 + alpha 阈值处理\n- **vtracer**: 样条曲线矢量化（比 potrace 更平滑）\n- **svgo**: SVG 路径压缩优化\n\n## 调用方式\n\n当需要将 PNG 转换为 SVG 时，按以下步骤执行：\n\n### 输入\n\n- `INPUT_PNG`: 输入 PNG 文件路径（必需）\n- `OUTPUT_SVG`: 输出 SVG 路径（默认：同名 .svg）\n- `KEEP_BG`: 是否保留背景（默认：false，去除白色背景）\n\n### 执行步骤\n\n#### Step 1: 预处理（去白底）\n\n如果需要去除背景（KEEP_BG=false）：\n\n```bash\nmagick INPUT_PNG \\\n  -fuzz 15% -transparent white \\\n  -channel A -threshold 50% +channel \\\n  INPUT_PNG.temp.png\n```\n\n#### Step 2: 矢量化\n\n```bash\nvtracer --input INPUT_PNG.temp.png --output OUTPUT_SVG \\\n  --mode spline \\\n  --filter_speckle 8 \\\n  --color_precision 8 \\\n  --corner_threshold 120 \\\n  --segment_length 6 \\\n  --path_precision 5\n```\n\n#### Step 3: 压缩优化\n\n```bash\nnpx svgo OUTPUT_SVG -o OUTPUT_SVG --multipass\n```\n\n#### Step 4: 清理\n\n```bash\nrm -f INPUT_PNG.temp.png\n```\n\n### 输出\n\n返回生成的 SVG 文件路径，并报告文件大小。\n\n```\n✓ PNG → SVG 转换完成\n\n输入: {INPUT_PNG}\n输出: {OUTPUT_SVG}\n大小: {file_size}\n```\n\n## 依赖\n\n首次使用前确保已安装：\n\n```bash\nbrew install imagemagick\ncargo install vtracer\nnpm install -g svgo  # 或使用 npx\n```\n\n## 参数调优\n\n| 参数 | 作用 | 调大效果 |\n|-----|------|---------|\n| `filter_speckle` | 过滤小斑点 | 更干净 |\n| `corner_threshold` | 角点阈值 | 更平滑 |\n| `segment_length` | 线段长度 | 更平滑 |\n| `color_precision` | 颜色精度 | 更准确 |","tags":["png2svg","skills","lovstudio","agent-skills","ai-coding-assistant","cjk","claude-code","cursor","gemini-cli","markdown-to-docx","markdown-to-pdf"],"capabilities":["skill","source-lovstudio","skill-png2svg","topic-agent-skills","topic-ai-coding-assistant","topic-cjk","topic-claude-code","topic-cursor","topic-gemini-cli","topic-markdown-to-docx","topic-markdown-to-pdf"],"categories":["skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/lovstudio/skills/png2svg","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add lovstudio/skills","source_repo":"https://github.com/lovstudio/skills","install_from":"skills.sh"}},"qualityScore":"0.477","qualityRationale":"deterministic score 0.48 from registry signals: · indexed on github topic:agent-skills · 54 github stars · SKILL.md body (1,349 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T18:57:49.189Z","embedding":null,"createdAt":"2026-04-18T22:19:04.752Z","updatedAt":"2026-05-18T18:57:49.189Z","lastSeenAt":"2026-05-18T18:57:49.189Z","tsv":"'1':110 '120':151 '15':122 '2':132 '3':159 '4':171 '5':157 '50':128 '6':154 '8':145,148 'alpha':70 'alpha阈值':61 'ask':28 'asset':47 'background':16 'bash':117,134,161,173,196 'bg':103,115 'brew':197 'cargo':200 'channel':125,129 'color':146,225 'compress':23 'convert':4,41 'corner':149,217 'edit':45 'f':175 'fals':106,116 'file':192 'filter':143,213 'fuzz':121 'g':205 'high':9 'high-qual':8 'icon':43 'imag':6 'imagemagick':67,199 'input':88,119,136,186 'input_png.temp.png':130,137,176 'instal':198,201,204 'keep':102,114 'length':153,222 'logo':38 'lovstudio':2 'lovstudio-png2svg':1 'magick':59,68,118 'mode':141 'multipass':169 'npm':203 'npx':162,208 'o':166 'option':13 'output':94,138,139,164,167,189 'path':155 'png':5,30,48,53,58,82,89,91,120,182,187 'png2svg':3,33 'potrac':75 'precis':147,156,226 'qualiti':10 'raster':42 'remov':17 'rm':174 'segment':152,221 'size':193 'skill':51 'skill-png2svg' 'source-lovstudio' 'speckl':144,214 'spline':19,142 'step':109,131,158,170 'svg':11,32,35,50,55,66,78,84,95,97,101,140,165,168,179,183,190 'svgo':22,64,77,163,206 'threshold':127,150,218 'topic-agent-skills' 'topic-ai-coding-assistant' 'topic-cjk' 'topic-claude-code' 'topic-cursor' 'topic-gemini-cli' 'topic-markdown-to-docx' 'topic-markdown-to-pdf' 'trace':39 'transpar':123 'use':24 'user':27 'vector':20,46 'vtracer':18,62,72,135,202 'white':15,124 'white-background':14 '作用':211 '依赖':194 '压缩':65 '压缩优化':160 '去白底':37,60,112 '去除白色背景':69,107 '参数':210 '参数调优':209 '同名':100 '图片转换为高质量矢量':54 '大小':191 '如果需要去除背景':113 '将':52 '工具链':57 '并报告文件大小':181 '当需要将':81 '必需':93 '或使用':207 '执行步骤':108 '按以下步骤执行':86 '支持去除白色背景':56 '文件路径':92,180 '时':85 '是否保留背景':104 '更准确':228 '更干净':216 '更平滑':76,220,224 '样条曲线':63 '样条曲线矢量化':73 '比':74 '清理':172 '矢量化':36,133 '线段长度':223 '角点阈值':219 '调大效果':212 '调用方式':80 '路径':98 '路径压缩优化':79 '转':34 '转换为':83 '转换完成':184 '输入':87,90,185 '输出':96,177,188 '过滤小斑点':215 '返回生成的':178 '阈值处理':71 '预处理':111 '颜色精度':227 '首次使用前确保已安装':195 '默认':99,105","prices":[{"id":"fb096271-27be-4523-9ca8-2cb8bbcf195a","listingId":"6a3ca52c-6ef8-489a-9bde-22fd140221dc","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"lovstudio","category":"skills","install_from":"skills.sh"},"createdAt":"2026-04-18T22:19:04.752Z"}],"sources":[{"listingId":"6a3ca52c-6ef8-489a-9bde-22fd140221dc","source":"github","sourceId":"lovstudio/skills/png2svg","sourceUrl":"https://github.com/lovstudio/skills/tree/main/skills/png2svg","isPrimary":false,"firstSeenAt":"2026-04-18T22:19:04.752Z","lastSeenAt":"2026-05-18T18:57:49.189Z"}],"details":{"listingId":"6a3ca52c-6ef8-489a-9bde-22fd140221dc","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"lovstudio","slug":"png2svg","github":{"repo":"lovstudio/skills","stars":54,"topics":["agent-skills","ai-coding-assistant","cjk","claude-code","cursor","gemini-cli","markdown-to-docx","markdown-to-pdf"],"license":"mit","html_url":"https://github.com/lovstudio/skills","pushed_at":"2026-05-17T09:28:31Z","description":"Top-level index for the Lovstudio skills ecosystem","skill_md_sha":"dd22b3867ee6e7ee943efd1f81326906ea711122","skill_md_path":"skills/png2svg/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/lovstudio/skills/tree/main/skills/png2svg"},"layout":"multi","source":"github","category":"skills","frontmatter":{"name":"lovstudio-png2svg","license":"MIT","description":"Convert PNG images to high-quality SVG with optional white-background removal, vtracer spline vectorization, and svgo compression. Use when the user asks for \"PNG to SVG\", \"png2svg\", \"转 SVG\", \"矢量化\", \"去白底\", logo tracing, or converting raster icons into editable vector assets.","compatibility":"Requires ImageMagick `magick`, vtracer, and svgo (`npx svgo` is supported). Works on macOS/Linux where those CLIs are installed."},"skills_sh_url":"https://skills.sh/lovstudio/skills/png2svg"},"updatedAt":"2026-05-18T18:57:49.189Z"}}