← 返回
内容创作

SVG Draw

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.
无需外部图形库(如PIL/ImageMagick),通过直接编写SVG文本生成自定义插图、头像或艺术作品(如“画一条龙”、“制作Logo”),并利用系统rsvg-convert工具将其转换为PNG格式。
lijy2015
内容创作 clawhub v1.0.0 1 版本 98823.5 Key: 无需
★ 6
Stars
📥 5,088
下载
💾 443
安装
1
版本
#latest

概述

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
  1. Write the SVG file

```bash

# Example: Write SVG to file

write('/path/to/output.svg', svg_content)

```

  1. Convert to PNG

```bash

/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
  • Background (prevents transparent backgrounds)
  • Appropriate width and height attributes

Common SVG elements:

  • Shapes: , , , ,
  • Text: with text-anchor="middle" for centering
  • Colors: Use hex codes or named colors
  • Opacity: Add opacity attribute for transparency effects

Example 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 <input.svg> <output.png> [width] [height]

Parameters:

  • input.svg: Source SVG file path
  • output.png: Destination PNG file path
  • width: 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:

  • Serpentine body with wings
  • Golden eyes with highlights
  • Horns and pointed ears
  • Curved tail
  • Magical sparkles
  • Name label: "大龙 🐉"

Customization ideas:

  • Change fill="#4a90d9" for different body colors
  • Adjust eye color by modifying fill="#ffcc00"
  • Add/remove features (scales, fire, etc.)
  • Change background color

Lobster Template (assets/lobster_template.svg)

Red lobster with:

  • Orange-red shell with segments
  • Large claws (left and right)
  • Eight walking legs
  • Eyes on stalks
  • Long antennae
  • Tail fan
  • Ocean bubbles background
  • Name label: "大龙虾 🦞"

Customization ideas:

  • Adjust shell color: fill="#e85d04" (darker red) or fill="#f48c06" (orange)
  • Change claw size or position
  • Add more bubbles
  • Modify background

Design Guidelines

Color Palettes

Friendly/Cute:

  • Body: #4a90d9 (blue), #f48c06 (orange)
  • Accents: #ffcc00 (yellow), #ff6b6b (coral)
  • Background: #1a1a2e (dark blue)

Professional:

  • Use muted tones
  • Stick to 2-3 main colors
  • Add subtle gradients if needed

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:

<text x="200" y="370" font-family="Arial, sans-serif" font-size="24" font-weight="bold" fill="#ffcc00" text-anchor="middle">Your Text</text>

Resources

scripts/

  • svg_to_png.sh - Convert SVG to PNG using rsvg-convert

assets/

  • dragon_template.svg - Friendly blue dragon
  • lobster_template.svg - Cute red lobster

Troubleshooting

SVG not rendering:

  • Check for proper tag with xmlns attribute
  • Ensure viewBox is set correctly
  • Verify all tags are closed

Conversion fails:

  • Confirm rsvg-convert is installed: which rsvg-convert
  • Check file paths are correct
  • Verify SVG syntax is valid

Image looks wrong:

  • Test SVG in browser first
  • Check coordinate system (viewBox vs width/height)
  • Verify element stacking order (later elements draw on top)

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-28 13:11 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

content-creation

Humanizer

biostartechnology
消除AI写作痕迹,使文本更自然真实。基于维基百科"AI写作特征"指南,识别并修正夸张象征、宣传用语、肤浅-ing分析、模糊归因、破折号滥用、三项排比、AI词汇、负面平行结构及冗长连接词等模式。
★ 857 📥 199,243
content-creation

AdMapix

fly0pants
广告情报与应用数据分析助手,支持搜索广告素材、分析应用排名、下载量、收入及市场洞察,用于广告素材和竞品分析。
★ 294 📥 136,396
content-creation

YouTube

byungkyu
使用托管OAuth集成YouTube Data API,支持搜索视频、管理播放列表、获取频道数据及评论互动,适用于用户需要时使用此技能。
★ 141 📥 41,013