本地高性能AI绘画助手
简介
基于本地 DrawThings 的 Stable Diffusion 图像生成工具,通过兼容 API 实现文生图,数据本地处理不上传,适合 Mac 用户高效创作。
原始描述
Generate images with DrawThings (Stable Diffusion) via API. Use when creating images from text prompts, running image generation workflows, or batch generating images. DrawThings runs locally on Mac with MLX/CoreML acceleration.
通过你的 Agent 添加
安装目录:drawthings/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
DrawThings Skill 是一个本地图像生成工具,通过 Python 脚本调用 DrawThings(Mac 上的 Stable Diffusion 实现)提供的 API。用户通过 python3 scripts/generate.py "prompt" 即可生成图像,支持自定义步数、采样器、CFG 比例、尺寸等参数,并提供 fast/quality/nft 三种预设配置。
API 兼容 Automatic1111 标准,主要端点为 POST /sdapi/v1/txt2img,支持 batch 批量生成和 seed 种子复现。输出为嵌入元数据的 PNG 文件,包含生成参数便于追溯。
显著优点
- 完全本地运行:所有计算在本地 DrawThings 完成,图像数据不离开设备,隐私性极强
- 零依赖风险:仅使用 Python 标准库 + requests,无第三方依赖包管理风险
- Mac 原生加速:利用 MLX/CoreML 实现 Apple Silicon 硬件加速
- 参数灵活可控:从 8 步快速草稿到 30 步高质量输出,CFG 比例 1-20 可调,适配不同创作需求
- 批量与复现:支持
--batch-size 多图生成和 --seed 固定种子,适合概念探索和可控复现
潜在缺点与局限性
- 平台限制:依赖 Mac 版 DrawThings,Windows/Linux 用户无法使用
- 模型切换不便:需手动在 DrawThings UI 切换模型,无法通过 API 动态选择
- 无内置重试机制:300 秒固定超时,大图像生成可能失败且无自动重试
- prompt 长度无校验:客户端未限制输入长度,依赖服务端截断
- UI 显示瑕疵:DrawThings 画布不自动清除,视觉上新旧图像叠加(不影响实际输出)
适合人群
- Mac 用户,尤其是 Apple Silicon 设备持有者
- 注重隐私、不希望图像数据上传云端的创作者
- 熟悉 Stable Diffusion 参数调优的中高级用户
- 需要批量生成、自动化工作流的开发者
常规风险
- 服务可用性:依赖本地 DrawThings 服务运行,需提前启动并开启 API 服务器
- 内存限制:大分辨率(1024+)或高步数可能触发 OOM,需适度降级
- 配置安全:若配置远程
DRAWTHINGS_URL,建议启用 HTTPS 防止中间人攻击
- 输出覆盖:默认输出文件名含时间戳,但显式指定
--output 可能意外覆盖已有文件
--batch-size 多图生成和 --seed 固定种子,适合概念探索和可控复现- 平台限制:依赖 Mac 版 DrawThings,Windows/Linux 用户无法使用
- 模型切换不便:需手动在 DrawThings UI 切换模型,无法通过 API 动态选择
- 无内置重试机制:300 秒固定超时,大图像生成可能失败且无自动重试
- prompt 长度无校验:客户端未限制输入长度,依赖服务端截断
- UI 显示瑕疵:DrawThings 画布不自动清除,视觉上新旧图像叠加(不影响实际输出)
适合人群
- Mac 用户,尤其是 Apple Silicon 设备持有者
- 注重隐私、不希望图像数据上传云端的创作者
- 熟悉 Stable Diffusion 参数调优的中高级用户
- 需要批量生成、自动化工作流的开发者
常规风险
- 服务可用性:依赖本地 DrawThings 服务运行,需提前启动并开启 API 服务器
- 内存限制:大分辨率(1024+)或高步数可能触发 OOM,需适度降级
- 配置安全:若配置远程
DRAWTHINGS_URL,建议启用 HTTPS 防止中间人攻击
- 输出覆盖:默认输出文件名含时间戳,但显式指定
--output 可能意外覆盖已有文件
- 服务可用性:依赖本地 DrawThings 服务运行,需提前启动并开启 API 服务器
- 内存限制:大分辨率(1024+)或高步数可能触发 OOM,需适度降级
- 配置安全:若配置远程
DRAWTHINGS_URL,建议启用 HTTPS 防止中间人攻击 - 输出覆盖:默认输出文件名含时间戳,但显式指定
--output可能意外覆盖已有文件
技能正文
name: drawthings
description: Generate images with DrawThings (Stable Diffusion) via API. Use when creating images from text prompts, running image generation workflows, or batch generating images. DrawThings runs locally on Mac with MLX/CoreML acceleration.
metadata:
openclaw:
emoji: "🎨"
requires:
env: ["DRAWTHINGS_URL"]
DrawThings Image Generation
Generate images using DrawThings, a local Stable Diffusion implementation for Mac with MLX/CoreML acceleration. DrawThings exposes an Automatic1111-compatible API for programmatic image generation.
When to Use
Use this skill when you need to:
- Generate images from text prompts
- Create variations of a concept
- Batch generate multiple images
- Test different models/samplers/settings
- Generate images with specific dimensions or quality settings
Configuration
Set the DRAWTHINGS_URL environment variable (defaults to http://127.0.0.1:7860):
export DRAWTHINGS_URL="http://127.0.0.1:7860"
Or configure in OpenClaw:
openclaw config set env.DRAWTHINGS_URL "http://127.0.0.1:7860"
Quick Start
Generate a single image:
python3 scripts/generate.py "a cyberpunk cat in neon city"
With custom settings:
python3 scripts/generate.py "a cyberpunk cat" \
--steps 20 \
--cfg-scale 7.5 \
--width 768 \
--height 768 \
--sampler "DPM++ 2M Karras"
Batch generation (5 variations):
python3 scripts/generate.py "a fantasy landscape" --batch-size 5
Save to specific location:
python3 scripts/generate.py "portrait photo" --output ./outputs/portrait.png
API Usage
The skill provides a Python script that wraps the DrawThings API (Automatic1111-compatible):
Main endpoint: POST /sdapi/v1/txt2img
Common parameters:
prompt- Text description of the imagenegative_prompt- What to avoid in the imagesteps- Number of diffusion steps (8-50, default: 20)sampler_name- Sampler algorithm (default: "DPM++ 2M Karras")cfg_scale- Classifier-free guidance scale (1.0-20.0, default: 7.0)width/height- Image dimensions (default: 512x512)batch_size- Number of images to generate (default: 1)seed- Random seed for reproducibility (-1 for random)
See references/api-reference.md for complete API documentation.
Presets
Fast (8 steps, UniPC Trailing):
python3 scripts/generate.py "your prompt" --preset fast
Quality (30 steps, DPM++ 2M Karras):
python3 scripts/generate.py "your prompt" --preset quality
NFT (optimized for 512x512 with good detail):
python3 scripts/generate.py "your prompt" --preset nft
Workflow Examples
Character variations:
python3 scripts/generate.py "electric sheep, glowing wool, cyberpunk" \
--batch-size 10 \
--steps 20 \
--cfg-scale 7.5
High-res output:
python3 scripts/generate.py "detailed portrait" \
--width 1024 \
--height 1024 \
--steps 30 \
--sampler "DPM++ 2M Karras"
Reproducible generation:
python3 scripts/generate.py "landscape" --seed 42
# Re-run with same seed for identical output
Output
Images are saved as PNG files with metadata embedded:
- Prompt, negative prompt
- Generation parameters (steps, sampler, cfg_scale, etc.)
- Timestamp and seed
Default location: ./drawthings_output_YYYYMMDD_HHMMSS.png
Troubleshooting
"Connection refused"
- Ensure DrawThings is running
- Check the API server is enabled in DrawThings preferences
- Verify the port matches (default: 7860)
"Generation failed"
- Check prompt length (max ~75 tokens per CLIP model)
- Reduce dimensions if out of memory
- Try a different sampler
Slow generation
- Use fewer steps (8-12 for drafts)
- Reduce image dimensions (512x512)
- Use faster samplers (UniPC, Euler A)
Canvas display quirk (visual only)
- DrawThings UI doesn't clear the canvas between generations
- New images appear to render on top of previous ones in the app
- This is purely cosmetic - API outputs are unaffected
Tips
- CFG Scale: Lower (1-3) for creative/artistic, higher (7-12) for prompt adherence
- Steps: 8-12 for drafts, 20-30 for final images, 50+ rarely needed
- Samplers: UniPC/Euler A are fast, DPM++ 2M Karras is quality, LCM for ultra-fast
- Dimensions: Keep to multiples of 64 (512, 768, 1024)
- Batch processing: Use
--batch-size for variations, not multiple script calls
Models
--batch-size for variations, not multiple script callsDrawThings supports Stable Diffusion models. To change models:
- Open DrawThings app
- Select model from the UI
- The API will use the currently selected model
See references/models.md for recommended models and download sources.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。