convert-svg
แปลงรูปภาพ bitmap เป็น SVG ด้วย bunx CLI
SKILL.mdconvert-svg/SKILL.md
GitHubGoal
Convert bitmap images (PNG/JPG) to SVG vectors with a bunx CLI
Scope
- Accept an image file as input
- Use potrace-based CLIs for tracing
- Support output paths and optimization
Execute
1. Identify Input
Goal: Validate the input
- Get the input path from the user
- Verify the file exists and is an image (png/jpg/jpeg/gif/bmp)
- Check the file size; if it is too large, resize first or warn the user
2. Choose CLI
Goal: Pick a tool that is ready to use
- Primary:
bunx images-to-svg convert <input>- Handles both files and directories
- Uses sharp, potrace, svgo
- Fallback:
bunx potrace-cli <input> -o output.svg - Fallback:
bunx potrace <input> -s -o output.svg - Last resort: install
sharp+potraceand write a Node/Bun script
3. Run Conversion
Goal: Convert bitmap to SVG
- Run the command with an output path
- If the input is a directory → convert everything in it
- Verify the output file
4. Optimize And Validate
Goal: Make the SVG correct and ready to use
- Optimize the output with
bunx svgoif desired - Check that the SVG opens in a browser
- Report the input/output paths
Rules
1. Quality
- Tracing works best on high-contrast images
- If the input is a colorful photo → warn the user the SVG may not be faithful
- For logos/line art → best results
2. Color
- potrace defaults to monochrome
- For color, use
images-to-svgor post-tracing steps
3. Fallback
If the first tool fails → try
potrace-cliIf that fails too → use a script with
sharp+potraceUse /convert-git-submodules if needed
Use /idea-convert-my-global-cli-to-skills if needed
Use /convert-files-format if needed
Use /draw-svg-image if needed
Expected Outcome
- A
.svgfile is generated from the bitmap - The SVG is editable and scalable
- Report the tool used and the output path