本地 SDXL 生图 (axelhu-local-sdxl)

基于 ComfyUI + SDXL 的本地图片生成技能。适用于需要高质量配图、素材生成、本地私密生图、或对在线生成有频率限制的场景。

3,891 stars

Best use case

本地 SDXL 生图 (axelhu-local-sdxl) is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

基于 ComfyUI + SDXL 的本地图片生成技能。适用于需要高质量配图、素材生成、本地私密生图、或对在线生成有频率限制的场景。

Teams using 本地 SDXL 生图 (axelhu-local-sdxl) should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/axelhu-local-sdxl/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/axelhu/axelhu-local-sdxl/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/axelhu-local-sdxl/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How 本地 SDXL 生图 (axelhu-local-sdxl) Compares

Feature / Agent本地 SDXL 生图 (axelhu-local-sdxl)Standard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

基于 ComfyUI + SDXL 的本地图片生成技能。适用于需要高质量配图、素材生成、本地私密生图、或对在线生成有频率限制的场景。

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# 本地 SDXL 生图 (axelhu-local-sdxl)

基于 ComfyUI + SDXL 的本地图片生成技能。适用于需要高质量配图、素材生成、本地私密生图、或对在线生成有频率限制的场景。

## 触发时机

**在以下场景时使用:**
- 用户/其他 agent 说"本地生图"、"本地SD生图"、"用本地工具生成图片"
- 用户/其他 agent 说"私密生图"、"脱敏生图"、"不上传在线"
- 需要生成涉及隐私、测试、商业素材的内容,且明确指定本地处理
- 需要精细控制构图、风格、尺寸的生图任务,且指定本地执行

**不要用于:**
- 默认生图请求(那些默认走在线服务,如 Midjourney/DALL-E)
- 用户说"生成图片"、"画一张图"且没有指定本地(默认在线优先)

## 使用方式

直接描述想要的图片内容,例如:
- "帮我生成一张科技感十足的封面图"
- "画一个程序员深夜编程的场景,插画风格"
- "生成一张杭州西湖的夜景图,高清写实风格"

Agent 收到后执行生图脚本,发送结果给用户。

## 技术规格

| 项目 | 参数 |
|------|------|
| 模型 | Stable Diffusion XL 1.0 (fp16) |
| 显卡 | NVIDIA RTX 3080 (10GB VRAM) |
| 出图尺寸 | 默认 1024×768,可调整 |
| 生图速度 | ~18秒/张(euler 采样,20步) |
| 可用采样器 | euler, dpmpp_2m, lcm, ddim 等 |
| API 端口 | localhost:8188 |

## Agent 调用方法

### 方式一:通过脚本调用(推荐)

```python
import subprocess
result = subprocess.run(
    ["python3", "/path/to/scripts/sdxl_generate.py",
     "--prompt", "一只狐狸在森林里",
     "--negative", "模糊, 低质量",
     "--steps", "20",
     "--seed", "42",
     "--output", "/tmp/output.png"],
    capture_output=True, text=True
)
print(result.stdout)
```

### 方式二:直接调 ComfyUI REST API

```python
import requests, time, json

COMFYUI = "http://localhost:8188"

def generate(prompt, negative="", steps=20, seed=42, width=1024, height=768):
    workflow = {
        "loader": {"class_type": "CheckpointLoaderSimple",
                   "inputs": {"ckpt_name": "sdxl-base-1.0.safetensors"}},
        "positive": {"class_type": "CLIPTextEncode",
                     "inputs": {"text": prompt, "clip": ["loader", 1]}},
        "negative": {"class_type": "CLIPTextEncode",
                      "inputs": {"text": negative, "clip": ["loader", 1]}},
        "latent": {"class_type": "EmptyLatentImage",
                   "inputs": {"width": width, "height": height, "batch_size": 1}},
        "sampler": {"class_type": "KSampler",
                    "inputs": {"seed": seed, "steps": steps, "cfg": 7.0,
                               "sampler_name": "euler", "scheduler": "normal",
                               "denoise": 1.0,
                               "positive": ["positive", 0], "negative": ["negative", 0],
                               "model": ["loader", 0], "latent_image": ["latent", 0]}},
        "decode": {"class_type": "VAEDecode",
                   "inputs": {"samples": ["sampler", 0], "vae": ["loader", 2]}},
        "save": {"class_type": "SaveImage",
                 "inputs": {"images": ["decode", 0], "filename_prefix": "sdxl_gen"}}
    }
    r = requests.post(f"{COMFYUI}/prompt", json={"prompt": workflow})
    pid = r.json()["prompt_id"]
    # 等待完成(轮询)
    for _ in range(30):
        time.sleep(2)
        hist = requests.get(f"{COMFYUI}/history/{pid}").json()
        if pid in hist:
            return f"{COMFYUI}/view?filename=sdxl_gen_00001_.png"
    return None
```

## 参数说明

| 参数 | 默认值 | 说明 |
|------|-------|------|
| `--prompt` | (必填) | 图片描述,越详细越好 |
| `--negative` | "blurry, low quality, distorted" | 反向提示词 |
| `--steps` | 20 | 采样步数,越高质量越好越慢 |
| `--seed` | 随机 | 种子,决定具体画面 |
| `--width` | 1024 | 宽度(8的倍数) |
| `--height` | 768 | 高度(8的倍数) |
| `--sampler` | euler | 采样器(euler/dpmpp_2m/lcm/ddim) |
| `--cfg` | 7.0 | CFG 强度(1-20) |
| `--output` | 自动 | 输出路径 |

## 快速参考:常用场景

| 场景 | 推荐参数 |
|------|---------|
| 写实风景/人物 | `--steps 25 --cfg 7 --sampler euler` |
| 动漫/插画风格 | `--steps 20 --cfg 8 --negative "写实, 照片"` |
| 快速草图/验证 | `--steps 4 --sampler lcm --cfg 1.0`(需要 LCM 模型) |
| 16:9 横幅图 | `--width 1280 --height 720` |

## 输出格式

生图完成后,脚本自动将图片保存到指定路径或 `/tmp/` 目录,并通过飞书发送图片消息给用户。

## 注意事项

- ComfyUI 服务必须已启动(`python3 main.py --port 8188`)
- RTX 3080 推荐分辨率 1024×768 以下,更高分辨率可能爆显存
- 生图过程约 18 秒,请提前告知用户等待
- 图片风格默认写实,如需特定风格在 prompt 中描述

Related Skills

ocr-local

3891
from openclaw/skills

Extract text from images using Tesseract.js OCR (100% local, no API key required). Supports Chinese (simplified/traditional) and English.

General Utilities

brand-butler-local-authority-engine

3891
from openclaw/skills

Brand Butler: Local Authority Engine — the white-glove SEO and AEO system for local service businesses. Use this skill immediately when the user asks about SEO rankings, backlinks, citations, site audits, Google Search Console indexing problems, competitor backlink analysis, directory submissions, schema markup, content placement articles, local map pack visibility, or AI answer engine optimization (Perplexity, ChatGPT, Google AI Overviews). Also triggers for any local business growth, online visibility, or 'why isn't my site ranking?' conversation. Works for agencies managing clients and business owners doing their own SEO. Covers HVAC, plumbing, electrical, law, dental, roofing, and any local service business. Built by Adrian Boysel.

Playwright Scrape (axelhu-playwright-scrape)

3891
from openclaw/skills

抓取动态网页(JS 渲染内容)的 Skill。基于 Playwright + 系统 Chrome,支持三种模式。

local-researcher

3891
from openclaw/skills

完全本地的深度研究助手 Skill。使用 Ollama 或 LMStudio 本地 LLM 进行迭代式网络研究,生成带引用来源的 Markdown 报告。当用户需要进行隐私优先的研究、本地文档分析或生成结构化研究报告时触发。

release-note-localizer

3891
from openclaw/skills

将发布说明转换为中文、英文、客户版和技术版,同时保持术语一致。;use for localization, release-notes, translation workflows;do not use for 机翻敏感合同条款, 替代专业法律翻译.

mlx-local-inference

3891
from openclaw/skills

Use when calling local AI on this Mac — text generation, embeddings, speech-to-text, OCR, or image understanding. LLM/VLM via oMLX gateway at localhost:8000/v1. Embedding/ASR/OCR via Python libraries (mlx-lm, mlx-vlm, mlx-audio). Works offline. Use instead of cloud APIs for privacy or low latency.

local-whisper

3891
from openclaw/skills

Local speech-to-text using OpenAI Whisper. Runs fully offline after model download. High quality transcription with multiple model sizes.

local-stt

3891
from openclaw/skills

Local STT with selectable backends - Parakeet (best accuracy) or Whisper (fastest, multilingual).

local-qrcode

3891
from openclaw/skills

Generate QR codes locally from text/URL to PNG image or ASCII art. Pure local generation using qrcode library. No API key required. Use when users need to create QR codes for links, text, or any content.

local-password

3891
from openclaw/skills

Generate secure random passwords and check password strength. Supports custom length and character types (uppercase, lowercase, numbers, symbols). Pure local operation, no external dependencies. Use when users need to generate new secure passwords or check password strength.

agent-browser-local

3891
from openclaw/skills

Headless browser automation CLI optimized for AI agents with accessibility tree snapshots and ref-based element selection

cloud-local-bridge

3891
from openclaw/skills

实现云端 OpenClaw 与本地 OpenClaw 之间的双向通信桥接。支持自然语言配对、命令执行、文件同步。