{"id":"6a3ca52c-6ef8-489a-9bde-22fd140221dc","shortId":"WunEDG","kind":"skill","title":"lovstudio:png2svg","tagline":"将 PNG 转换为高质量 SVG（去白底+样条曲线+压缩）","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.470","qualityRationale":"deterministic score 0.47 from registry signals: · indexed on github topic:agent-skills · 40 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-04-22T00:56:34.819Z","embedding":null,"createdAt":"2026-04-18T22:19:04.752Z","updatedAt":"2026-04-22T00:56:34.819Z","lastSeenAt":"2026-04-22T00:56:34.819Z","tsv":"'1':72 '120':113 '15':84 '2':94 '3':121 '4':133 '5':119 '50':90 '6':116 '8':107,110 'alpha':32 'alpha阈值':23 'bash':79,96,123,135,158 'bg':65,77 'brew':159 'cargo':162 'channel':87,91 'color':108,187 'corner':111,179 'f':137 'fals':68,78 'file':154 'filter':105,175 'fuzz':83 'g':167 'imagemagick':29,161 'input':50,81,98,148 'input_png.temp.png':92,99,138 'instal':160,163,166 'keep':64,76 'length':115,184 'lovstudio':1 'magick':21,30,80 'mode':103 'multipass':131 'npm':165 'npx':124,170 'o':128 'output':56,100,101,126,129,151 'path':117 'png':4,10,15,20,44,51,53,82,144,149 'png2svg':2 'potrac':37 'precis':109,118,188 'rm':136 'segment':114,183 'size':155 'skill':13 'skill-png2svg' 'source-lovstudio' 'speckl':106,176 'spline':104 'step':71,93,120,132 'svg':6,12,17,28,40,46,57,59,63,102,127,130,141,145,152 'svgo':26,39,125,168 'threshold':89,112,180 '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' 'transpar':85 'vtracer':24,34,97,164 'white':86 '作用':173 '依赖':156 '压缩':9,27 '压缩优化':122 '去白底':7,22,74 '去除白色背景':31,69 '参数':172 '参数调优':171 '同名':62 '图片转换为高质量矢量':16 '大小':153 '如果需要去除背景':75 '将':3,14 '工具链':19 '并报告文件大小':143 '当需要将':43 '必需':55 '或使用':169 '执行步骤':70 '按以下步骤执行':48 '支持去除白色背景':18 '文件路径':54,142 '时':47 '是否保留背景':66 '更准确':190 '更干净':178 '更平滑':38,182,186 '样条曲线':8,25 '样条曲线矢量化':35 '比':36 '清理':134 '矢量化':95 '线段长度':185 '角点阈值':181 '调大效果':174 '调用方式':42 '路径':60 '路径压缩优化':41 '转换为':45 '转换为高质量':5 '转换完成':146 '输入':49,52,147 '输出':58,139,150 '过滤小斑点':177 '返回生成的':140 '阈值处理':33 '预处理':73 '颜色精度':189 '首次使用前确保已安装':157 '默认':61,67","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-04-22T00:56:34.819Z"}],"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":40,"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-04-21T15:57:51Z","description":"Agent skills for AI coding assistants — Markdown to PDF/DOCX with 14 themes, CJK support","skill_md_sha":"77deef3d50a56c475acc4bda83655e9b9ae7e114","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","description":"将 PNG 转换为高质量 SVG（去白底+样条曲线+压缩）"},"skills_sh_url":"https://skills.sh/lovstudio/skills/png2svg"},"updatedAt":"2026-04-22T00:56:34.819Z"}}