SVG Draw
by @lijy2015
Create SVG images and convert them to PNG without external graphics libraries. Use when you need to generate custom illustrations, avatars, or artwork (e.g., "draw a dragon", "create an avatar", "make a logo") or convert SVG files to PNG format. This skill works by writing SVG text directly (no PIL/ImageMagick required) and uses system rsvg-convert for PNG conversion.
clawhub install svg-drawπ About This Skill
name: svg-draw description: Create SVG images and convert them to PNG without external graphics libraries. Use when you need to generate custom illustrations, avatars, or artwork (e.g., "draw a dragon", "create an avatar", "make a logo") or convert SVG files to PNG format. This skill works by writing SVG text directly (no PIL/ImageMagick required) and uses system rsvg-convert for PNG conversion.
SVG Draw
Generate vector graphics and raster images using pure SVG code and system conversion tools.
Quick Start
For new drawings:
1. Write SVG code directly to a file (use templates in assets/ as starting points)
2. Convert to PNG using the conversion script
3. Send via the appropriate channel (DingTalk, Telegram, etc.)
For existing SVG files: 1. Use the conversion script to convert SVG β PNG 2. Share the resulting image
Creating SVG Images
Basic Workflow
1. Choose or create a template
- Check assets/ for existing templates (dragon, lobster, etc.)
- Or write SVG from scratch
2. Write the SVG file
# Example: Write SVG to file
write('/path/to/output.svg', svg_content)
3. Convert to PNG
/root/.openclaw/workspace/skills/svg-draw/scripts/svg_to_png.sh input.svg output.png 400 400
SVG Structure Tips
Always include:
tag with xmlns="http://www.w3.org/2000/svg" and viewBox (prevents transparent backgrounds)width and height attributesCommon SVG elements:
, , , , with text-anchor="middle" for centeringopacity attribute for transparency effectsExample character structure:
Background β Body β Head β Face features β Limbs β Accessories β Name
Converting SVG to PNG
Use the bundled conversion script:
/root/.openclaw/workspace/skills/svg-draw/scripts/svg_to_png.sh [width] [height]
Parameters:
input.svg: Source SVG file pathoutput.png: Destination PNG file pathwidth: Output width in pixels (default: 400)height: Output height in pixels (default: 400)Example:
/root/.openclaw/workspace/skills/svg-draw/scripts/svg_to_png.sh dragon.svg dragon.png 512 512
Available Templates
Dragon Template (assets/dragon_template.svg)
Blue dragon with:
Customization ideas:
fill="#4a90d9" for different body colorsfill="#ffcc00"Lobster Template (assets/lobster_template.svg)
Red lobster with:
Customization ideas:
fill="#e85d04" (darker red) or fill="#f48c06" (orange)Design Guidelines
Color Palettes
Friendly/Cute:
#4a90d9 (blue), #f48c06 (orange)#ffcc00 (yellow), #ff6b6b (coral)#1a1a2e (dark blue)Professional:
Character Design Principles
1. Keep it simple β Too many details look messy at small sizes 2. Use contrast β Light features on dark backgrounds 3. Add personality β Eyes, expressions, small details 4. Include a label β Add name/title at the bottom for context 5. Test at target size β View at 400x400 to check readability
Common Tasks
Creating an Avatar
1. Start with a template that matches the vibe (dragon, lobster, etc.) 2. Modify colors and features 3. Add personal touches (accessories, expressions) 4. Add name label at bottom 5. Convert and send
Making a Logo
1. Use simple geometric shapes 2. Limit to 2-3 colors 3. Consider scalable design 4. Test at multiple sizes 5. Export at higher resolution (800x800 or 1024x1024)
Customizing Templates
Change colors: Find fill="#" or stroke="#" attributes and replace the hex codes
Resize elements: Adjust rx, ry (ellipses) or width, height (rectangles)
Reposition: Modify cx, cy (circles/ellipses) or x, y (rectangles)
Add text:
Your Text
Resources
scripts/
svg_to_png.sh - Convert SVG to PNG using rsvg-convertassets/
dragon_template.svg - Friendly blue dragonlobster_template.svg - Cute red lobsterTroubleshooting
SVG not rendering:
tag with xmlns attributeviewBox is set correctlyConversion fails:
rsvg-convert is installed: which rsvg-convertImage looks wrong:
π‘ Examples
For new drawings:
1. Write SVG code directly to a file (use templates in assets/ as starting points)
2. Convert to PNG using the conversion script
3. Send via the appropriate channel (DingTalk, Telegram, etc.)
For existing SVG files: 1. Use the conversion script to convert SVG β PNG 2. Share the resulting image
π Tips & Best Practices
SVG not rendering:
tag with xmlns attributeviewBox is set correctlyConversion fails:
rsvg-convert is installed: which rsvg-convertImage looks wrong: