← Back to Skills Marketplace
tobewin

Avatar Generator

by ToBeWin · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
168
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install avatar-generator
Description
Generate customizable avatars in six styles with multi-platform export for social media including WeChat, QQ, Twitter, and Discord.
README (SKILL.md)

Avatar Generator

Professional avatar generator with 6 styles, multi-platform export, and customizable options.

Features

  • 🎨 6 Avatar Styles: Letter, Geometric, Gradient, Abstract, Pattern, Badge
  • 📱 Multi-Platform: Auto-export for 9+ platforms
  • 🎯 Customizable: Colors, shapes, sizes, fonts
  • Fast Generation: Local Pillow rendering
  • 🌍 Multi-Language: Chinese and English support

Supported Platforms

Platform Size Shape Priority
WeChat 640×640 Square ⭐⭐⭐⭐⭐
QQ 100×100 Square ⭐⭐⭐⭐⭐
Xiaohongshu 400×400 Round ⭐⭐⭐⭐
Weibo 200×200 Round ⭐⭐⭐⭐
Twitter/X 400×400 Round ⭐⭐⭐⭐
Discord 128×128 Round ⭐⭐⭐
Reddit 256×256 Round ⭐⭐⭐
Facebook 170×170 Round ⭐⭐⭐
LinkedIn 400×400 Square ⭐⭐⭐

Avatar Styles

1. Letter Avatar (Initial Letter)

  • Single letter or initials
  • Clean background
  • Professional look
  • Best for: Business, professional

2. Geometric Avatar

  • Abstract shapes
  • Modern design
  • Eye-catching
  • Best for: Tech, creative

3. Gradient Avatar

  • Smooth color transitions
  • Trendy look
  • Customizable
  • Best for: Social media

4. Abstract Avatar

  • Artistic patterns
  • Unique design
  • Stand out
  • Best for: Creative, personal

5. Pattern Avatar

  • Repeating elements
  • Structured design
  • Brand identity
  • Best for: Teams, companies

6. Badge Avatar

  • Circular frame
  • Official look
  • Identity badge
  • Best for: Certification, ID

Trigger Conditions

  • "Generate avatar" / "生成头像"
  • "Create WeChat avatar" / "做微信头像"
  • "Make social media avatar" / "生成社交头像"
  • "avatar-generator"

Python Code

from PIL import Image, ImageDraw, ImageFont
import os
import colorsys
import random

class AvatarGenerator:
    def __init__(self):
        self.platforms = {
            'wechat': {'size': (640, 640), 'shape': 'square'},
            'qq': {'size': (100, 100), 'shape': 'square'},
            'xiaohongshu': {'size': (400, 400), 'shape': 'round'},
            'weibo': {'size': (200, 200), 'shape': 'round'},
            'twitter': {'size': (400, 400), 'shape': 'round'},
            'discord': {'size': (128, 128), 'shape': 'round'},
            'reddit': {'size': (256, 256), 'shape': 'round'},
            'facebook': {'size': (170, 170), 'shape': 'round'},
            'linkedin': {'size': (400, 400), 'shape': 'square'},
        }
    
    def _load_font(self, size):
        """Load font with fallback"""
        paths = [
            '/System/Library/Fonts/PingFang.ttc',
            '/System/Library/Fonts/STHeiti Light.ttc',
            '/usr/share/fonts/truetype/noto/NotoSansCJK-Regular.ttc',
        ]
        for p in paths:
            if os.path.exists(p):
                try:
                    return ImageFont.truetype(p, size)
                except:
                    continue
        return ImageFont.load_default()
    
    def create_letter_avatar(self, letter, bg_color, text_color, size=(400, 400)):
        """Style 1: Letter avatar"""
        img = Image.new('RGB', size, bg_color)
        draw = ImageDraw.Draw(img)
        
        font = self._load_font(size[0] // 2)
        
        bbox = draw.textbbox((0, 0), letter, font=font)
        w, h = bbox[2] - bbox[0], bbox[3] - bbox[1]
        x, y = (size[0] - w) // 2, (size[1] - h) // 2
        
        draw.text((x, y), letter, font=font, fill=text_color)
        return img
    
    def create_geometric_avatar(self, colors, size=(400, 400)):
        """Style 2: Geometric avatar"""
        img = Image.new('RGB', size, colors[0])
        draw = ImageDraw.Draw(img)
        
        # Add geometric shapes
        center = size[0] // 2
        draw.ellipse([(50, 50), (size[0]-50, size[1]-50)], fill=colors[1])
        draw.regular_polygon((center, center, size[0]//3), 6, fill=colors[2])
        
        return img
    
    def create_gradient_avatar(self, color1, color2, size=(400, 400)):
        """Style 3: Gradient avatar"""
        import numpy as np
        
        img = np.zeros((size[1], size[0], 3), dtype=np.uint8)
        for y in range(size[1]):
            ratio = y / size[1]
            r = int(color1[0] * (1-ratio) + color2[0] * ratio)
            g = int(color1[1] * (1-ratio) + color2[1] * ratio)
            b = int(color1[2] * (1-ratio) + color2[2] * ratio)
            img[y, :] = [r, g, b]
        
        return Image.fromarray(img)
    
    def create_abstract_avatar(self, seed, colors, size=(400, 400)):
        """Style 4: Abstract avatar"""
        random.seed(seed)
        img = Image.new('RGB', size, colors[0])
        draw = ImageDraw.Draw(img)
        
        for _ in range(10):
            x, y = random.randint(0, size[0]), random.randint(0, size[1])
            r = random.randint(20, 100)
            color = random.choice(colors[1:])
            draw.ellipse([(x-r, y-r), (x+r, y+r)], fill=color)
        
        return img
    
    def create_pattern_avatar(self, pattern_type, colors, size=(400, 400)):
        """Style 5: Pattern avatar"""
        img = Image.new('RGB', size, colors[0])
        draw = ImageDraw.Draw(img)
        
        cell_size = 40
        for x in range(0, size[0], cell_size):
            for y in range(0, size[1], cell_size):
                if (x // cell_size + y // cell_size) % 2 == 0:
                    draw.rectangle([(x, y), (x+cell_size, y+cell_size)], fill=colors[1])
        
        return img
    
    def create_badge_avatar(self, text, bg_color, border_color, size=(400, 400)):
        """Style 6: Badge avatar"""
        img = Image.new('RGB', size, (255, 255, 255))
        draw = ImageDraw.Draw(img)
        
        # Draw circular badge
        margin = 20
        draw.ellipse([(margin, margin), (size[0]-margin, size[1]-margin)], 
                     fill=bg_color, outline=border_color, width=5)
        
        # Add text
        font = self._load_font(size[0] // 4)
        bbox = draw.textbbox((0, 0), text, font=font)
        w, h = bbox[2] - bbox[0], bbox[3] - bbox[1]
        x, y = (size[0] - w) // 2, (size[1] - h) // 2
        draw.text((x, y), text, font=font, fill='white')
        
        return img
    
    def make_round(self, img):
        """Make image circular"""
        size = img.size
        mask = Image.new('L', size, 0)
        draw = ImageDraw.Draw(mask)
        draw.ellipse([(0, 0), size], fill=255)
        
        result = Image.new('RGBA', size, (0, 0, 0, 0))
        result.paste(img, mask=mask)
        return result
    
    def export_multi_platform(self, img, output_dir, platforms=None):
        """Export for multiple platforms"""
        os.makedirs(output_dir, exist_ok=True)
        
        if platforms is None:
            platforms = list(self.platforms.keys())
        
        exported = []
        for platform in platforms:
            if platform in self.platforms:
                config = self.platforms[platform]
                resized = img.resize(config['size'], Image.LANCZOS)
                
                if config['shape'] == 'round':
                    resized = self.make_round(resized)
                
                path = os.path.join(output_dir, f'avatar_{platform}.png')
                resized.save(path)
                exported.append(path)
        
        return exported

# Example usage
gen = AvatarGenerator()

# Letter avatar
avatar1 = gen.create_letter_avatar('Z', (30, 60, 114), (255, 255, 255))

# Gradient avatar
avatar2 = gen.create_gradient_avatar((67, 142, 219), (30, 60, 114))

# Export to all platforms
gen.export_multi_platform(avatar1, 'output/')

Usage Examples

User: "Generate a WeChat avatar with blue background and white Z"
Agent: Create 640×640 letter avatar

User: "Make a gradient avatar for Xiaohongshu"
Agent: Create 400×400 round gradient avatar

User: "Create social media avatars"
Agent: Generate avatars for all platforms

Notes

  • All avatars generated locally with Pillow
  • No external API required
  • Cross-platform compatible
  • Supports Chinese and English text
Usage Guidance
This skill appears to be a straightforward local avatar generator, but take these precautions before using it: (1) The skill source is unknown and has no homepage — review the SKILL.md and embedded code yourself. (2) Ensure you have Python 3 installed and install required packages: at minimum Pillow, and also numpy (the code imports numpy for gradients). (3) The code will read system font files (to render text) and will write image files to disk — run it in a safe/sandboxed environment if you are concerned about file access. (4) There are minor metadata inconsistencies (registry says no required binaries while SKILL.md lists python3; dependency list omits numpy) — fix these before running to avoid runtime errors. (5) No network calls or credential access were found in the provided files, but if the skill is later modified to add export/upload features, re-check for endpoints or secret usage.
Capability Analysis
Type: OpenClaw Skill Name: avatar-generator Version: 1.0.0 The avatar-generator skill is a legitimate tool for creating profile pictures using the Pillow library. The Python code in SKILL.md implements various drawing styles (letter, geometric, gradient) and exports them to standard platform sizes locally. There are no indicators of data exfiltration, malicious execution, or prompt injection; the code only interacts with standard system font paths and the local filesystem for saving generated images.
Capability Assessment
Purpose & Capability
The SKILL.md, description, and embedded Python code all implement an avatar generator (letter, geometric, gradient, abstract, pattern, badge) and auto-exporting to multiple platform sizes — consistent with the stated purpose. Minor mismatch: registry metadata earlier declared no required binaries, but SKILL.md metadata lists python3 as a required binary.
Instruction Scope
Instructions and the included Python code perform only local image rendering and file operations (Pillow, drawing, randomization, resizing, saving). The code attempts to load system font files (paths under /System/Library and /usr/share/fonts), which means it will read system font files if present. It does not reference network endpoints or request secrets. The gradient routine imports numpy, but the SKILL.md dependency text only lists Pillow — that dependency mismatch is a runtime correctness issue (not a direct security red flag) but worth fixing.
Install Mechanism
This is an instruction-only skill with no install spec; nothing is auto-downloaded or written by an installation step. SKILL.md suggests 'pip install pillow' but provides no automated install. No external URLs or archive downloads are used.
Credentials
The skill does not request any environment variables, credentials, or config paths beyond reading typical system font paths. No tokens/keys/passwords are requested — proportional to its purpose.
Persistence & Privilege
always is false and there are no special persistence requests. The skill does not attempt to modify other skills or agent system settings.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install avatar-generator
  3. After installation, invoke the skill by name or use /avatar-generator
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
专业头像生成器:6种风格,支持9+社交平台,多尺寸导出
Metadata
Slug avatar-generator
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Avatar Generator?

Generate customizable avatars in six styles with multi-platform export for social media including WeChat, QQ, Twitter, and Discord. It is an AI Agent Skill for Claude Code / OpenClaw, with 168 downloads so far.

How do I install Avatar Generator?

Run "/install avatar-generator" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Avatar Generator free?

Yes, Avatar Generator is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Avatar Generator support?

Avatar Generator is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Avatar Generator?

It is built and maintained by ToBeWin (@tobewin); the current version is v1.0.0.

💬 Comments