svg-to-raster
Skill21 starsChanged 8 days agoMITView on GitHub
Use when the user wants to rasterize SVG files — convert SVG to PNG, PDF, or PostScript at a chosen resolution. Wraps CairoSVG (Python, in the plugin venv). Single file or batch. Companion to `vectorize` (other direction).
- Installs packages
In this repository28 other files it gives its agents.
- ai-graphicsSkill
- auto-deskewSkill
- auto-toneSkill
- auto-white-balanceSkill
- batch-set-copyrightSkill
- check-model-pricingSkill
- convert-to-avifSkill
- fast-resizeSkill
- fast-thumbnailSkill
- from-jxlSkill
- images-to-pdfSkill
- install-depsSkill
- new-projectSkill
- new-workflowSkill
- open-workspaceSkill
- optimize-jpegSkill
- optimize-pngSkill
- pdf-extract-embedded-imagesSkill
- pdf-to-imagesSkill
- read-metadataSkill
- scrub-metadataSkill
- set-metadataSkill
- to-jxlSkill
- transcode-jpeg-to-jxl-losslessSkill
- upscale-imageSkill
- vectorizeSkill
- web-readySkill
- workspace-setupSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Do not use this skill when:
- Very specific: line 36
Verify cairosvg is importable in the venv:
- Very specific: line 42
If missing → point at install-deps.
- Very specific: line 75
If you need true SVG editing or advanced filter support, look at Inkscape CLI (inkscape --export-type=png).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SVG to Raster
Rasterize SVG files to PNG / PDF / PS via CairoSVG. Runs from the plugin's uv venv — no system Python pollution.
When to use
- Convert logo / icon / diagram SVGs to PNG for use in slides, social, or pipelines that don't accept SVG.
- Render an SVG at multiple resolutions (e.g. 1×, 2×, 3× for app assets).
- Bake an SVG into a PDF for print or archival.
Do not use this skill when:
- Source is already raster — wrong direction; use
vectorizeinstead. - You need to edit the SVG — CairoSVG is render-only.
- The SVG uses advanced filters / unsupported CSS — CairoSVG covers SVG 1.1 well but newer features may not render. Inspect output and warn the user.
Inputs
- Input — SVG file or directory. Required.
- Format —
png(default),pdf,ps. - Output dir — default:
<input-dir>/<format>/. Never overwrites originals. - Scale — multiplier on the SVG's intrinsic size. Default
1.0. Use2.0,3.0for hi-DPI. - Width / Height — explicit pixel dimensions (overrides scale). Pass one to preserve aspect; both to force.
- DPI — for PDF/PS output. Default
96. - Background — default transparent. Pass a CSS colour (
#ffffff,white) for solid fill. - Recursive —
--recursivefor directory descent.
Procedure
- Resolve venv:
VENV_DIR="${CLAUDE_USER_DATA:-${XDG_DATA_HOME:-$HOME/.local/share}/claude-plugins}/image-production/venv". Verify
cairosvgis importable in the venv:"$VENV_DIR/bin/python" -c "import cairosvg" 2>&1If missing → point at
install-deps. If it imports but raises a libcairo error, surface the system-lib install command (sudo apt install libcairo2/brew install cairo).- Enumerate
*.svginputs (case-insensitive). Skip non-SVG with note. For each file, call CairoSVG via Python one-liner (keeps the skill self-contained — no helper script needed):
"$VENV_DIR/bin/python" -c " import cairosvg, sys kwargs = {'url': sys.argv[1], 'write_to': sys.argv[2]} # Inject scale / dimensions / dpi / background as appropriate cairosvg.svg2png(**kwargs) # or svg2pdf / svg2ps " "<input.svg>" "<output.png>"Function map:
png → svg2png,pdf → svg2pdf,ps → svg2ps.Optional kwargs:
scale=<float>,output_width=<int>,output_height=<int>,dpi=<int>,background_color="<css>".- Track file sizes and any render warnings (CairoSVG prints to stderr for unsupported features).
Output
- Rasterized files at
<output-dir>/. - Summary:
- Files processed / failed.
- Per-file: source dimensions → output dimensions, output size.
- Any render warnings (unsupported SVG features).
Notes
- CairoSVG is LGPL-3.0; using it as a CLI dependency is fine, no licence contagion.
- For multi-resolution batch (e.g. app icon set), call this skill multiple times with different
--scalevalues, or wrap in a small loop. - If you need true SVG editing or advanced filter support, look at Inkscape CLI (
inkscape --export-type=png). CairoSVG is the lighter-weight pure-Python option. - Animated SVG (SMIL) is not supported — CairoSVG renders the initial frame only.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

