Svg to png

From sean-sunagaku/claude-code-plugin · View interactive version

Svg to png is an AI agent skill from the GitHub repository sean-sunagaku/claude-code-plugin. Convert SVG files to high-quality PNG images with precise control over dimensions, background color, and CSS rendering (including mix-blend-mode, filters, gradients). Use this skill when the user wants to: (1) convert SVG to PNG, (2) generate app icons or splash screens from SVG source, (3) batch-ge

How to use this skill

Skill file

SVG to PNG Conversion

Convert SVG to high-quality PNG using sharp with automatic density calculation.

Prerequisites

Ensure sharp is installed in the project (npm install sharp). Install it if missing before running the script.

Script Location

scripts/convert_svg.mjs — the main conversion script.

Single File Conversion

node scripts/convert_svg.mjs --input logo.svg --output logo.png --width 1024
node scripts/convert_svg.mjs --input logo.svg --width 512 --height 512 --background "#1a1a2e"

Arguments:

Preset Batch Conversion

Generate multiple PNGs from one SVG using built-in presets:

node scripts/convert_svg.mjs --input logo.svg --preset app-icon --output-dir ./icons
node scripts/convert_svg.mjs --input logo.svg --preset splash-portrait --output-dir ./splash

Arguments:

Available presets: app-icon, splash-portrait, splash-icon, favicon, og-image.

For preset details and sizes, see references/presets.md.

Quality: How Density Works

sharp rasterises SVG at a given DPI (density). The script auto-calculates:

density = 72 * target_width / svg_viewbox_width

A 100-wide viewBox rendered at 1024px uses density 737, producing crisp output. No manual tuning needed.

Important Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.