image-gen
AI 图片生成。通过 ModelScope API 生成图片,支持文生图、异步任务轮询、LoRA 风格叠加、自定义尺寸。当用户要求生成图片、画图、创建插画、制作海报配图时使用。
Best use case
image-gen is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
AI 图片生成。通过 ModelScope API 生成图片,支持文生图、异步任务轮询、LoRA 风格叠加、自定义尺寸。当用户要求生成图片、画图、创建插画、制作海报配图时使用。
Teams using image-gen 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
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/image-gen/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How image-gen Compares
| Feature / Agent | image-gen | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
AI 图片生成。通过 ModelScope API 生成图片,支持文生图、异步任务轮询、LoRA 风格叠加、自定义尺寸。当用户要求生成图片、画图、创建插画、制作海报配图时使用。
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.
SKILL.md Source
# AI 图片生成
基于 ModelScope API 的文生图工具,支持异步生成、LoRA 风格叠加。
## 配置
编辑 `skills/image-gen/scripts/config.json`:
```json
{
"api_token": "YOUR_MODELSCOPE_TOKEN"
}
```
Token 获取:[ModelScope 控制台](https://modelscope.cn/my/myaccesstoken) 创建 Access Token。
## 命令行调用
```bash
# 基础文生图
python3 skills/image-gen/scripts/generate.py generate --prompt "一只金色的猫"
# 指定输出路径
python3 skills/image-gen/scripts/generate.py generate --prompt "赛博朋克城市" --output cyberpunk.jpg
# 指定模型
python3 skills/image-gen/scripts/generate.py generate --prompt "水墨山水画" --model Tongyi-MAI/Z-Image-Turbo
# 使用 LoRA 风格
python3 skills/image-gen/scripts/generate.py generate --prompt "一个女孩" --lora "repo-id/lora-model"
# 多 LoRA 叠加(JSON 格式,权重之和为 1.0)
python3 skills/image-gen/scripts/generate.py generate --prompt "风景画" --lora '{"lora1": 0.6, "lora2": 0.4}'
# 指定尺寸
python3 skills/image-gen/scripts/generate.py generate --prompt "壁纸" --size 1920x1080
# 查询任务状态
python3 skills/image-gen/scripts/generate.py status --task-id TASK_ID
# JSON 格式输出
python3 skills/image-gen/scripts/generate.py generate --prompt "猫" --json
```
## AI 调用流程
### 步骤 1:生成图片
根据用户描述构造英文 prompt(英文效果更好),调用脚本生成图片并保存到本地:
```bash
python3 skills/image-gen/scripts/generate.py generate --prompt "A cute golden cat, high quality, detailed fur, studio lighting" --output data/temp/images/golden_cat.jpg
```
### 步骤 2:发送到频道(自动联动 send_media)
图片生成成功后,如果当前是频道会话(飞书/QQ/钉钉/Telegram 等),必须使用内置工具 `send_media` 将图片发送给用户:
```
send_media(file_paths=["data/temp/images/golden_cat.jpg"], message="已为你生成图片 🎨")
```
如果是网页会话,直接告知用户图片保存路径即可。
### 完整示例
用户说"帮我画一只猫":
1. 执行生成:
```bash
python3 skills/image-gen/scripts/generate.py generate --prompt "A cute golden cat, high quality, detailed fur" --output data/temp/images/cat.jpg
```
2. 发送到频道:
```
send_media(file_paths=["data/temp/images/cat.jpg"], message="🎨 已生成图片:一只金色的猫")
```
用户说"画一张赛博朋克风格的城市壁纸":
1. 执行生成:
```bash
python3 skills/image-gen/scripts/generate.py generate --prompt "Cyberpunk city skyline, neon lights, rain, cinematic, 4K" --output data/temp/images/cyberpunk.jpg --size 1920x1080
```
2. 发送到频道:
```
send_media(file_paths=["data/temp/images/cyberpunk.jpg"], message="🎨 赛博朋克城市壁纸")
```
## 支持的模型
| 模型 | 说明 |
|------|------|
| `Tongyi-MAI/Z-Image-Turbo` | 默认,通义万相快速生成 |
可通过 `--model` 参数指定 ModelScope 上其他文生图模型。
## Prompt 技巧
- 使用英文 prompt 效果更好
- 加入质量描述词:`high quality`, `detailed`, `4K`, `studio lighting`
- 加入风格描述:`oil painting`, `watercolor`, `anime style`, `photorealistic`
- 加入构图描述:`close-up`, `wide angle`, `bird's eye view`
- 负面描述可以在 prompt 中用 `no xxx` 表达
## 注意事项
- 异步生成,脚本会自动轮询直到完成(默认超时 5 分钟)
- 生成的图片建议保存到 `data/temp/images/` 目录
- LoRA 最多叠加 6 个,权重之和必须为 1.0
- 频道会话中生成图片后务必调用 `send_media` 发送,不要只返回文件路径Related Skills
image-optimization-helper
Image Optimization Helper - Auto-activating skill for Frontend Development. Triggers on: image optimization helper, image optimization helper Part of the Frontend Development skill category.
gpt-image-1-5
Generate and edit images using OpenAI's GPT Image 1.5 model. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports text-to-image generation and image editing with optional mask. DO NOT read the image file first - use this skill directly with the --input-image parameter.
azure-image-builder
Build Azure managed images and Azure Compute Gallery images with Packer. Use when creating custom images for Azure VMs.
java-add-graalvm-native-image-support
GraalVM Native Image expert that adds native image support to Java applications, builds the project, analyzes build errors, applies fixes, and iterates until successful compilation using Oracle best practices.
image-manipulation-image-magick
Process and manipulate images using ImageMagick. Supports resizing, format conversion, batch processing, and retrieving image metadata. Use when working with images, creating thumbnails, resizing wallpapers, or performing batch image operations.
OpenAI Image Gen
Generate a handful of “random but structured” prompts and render them via the OpenAI Images API.
Nano Banana Pro (Gemini 3 Pro Image)
Use the bundled script to generate or edit images.
image-analysis
图片分析与识别,可分析本地图片、网络图片、视频、文件。适用于 OCR、物体识别、场景理解等。当用户发送图片或要求分析图片时必须使用此技能。
image-assistant
配图助手 - 把文章/模块内容转成统一风格、少字高可读的 16:9 信息图提示词;先定“需要几张图+每张讲什么”,再压缩文案与隐喻,最后输出可直接复制的生图提示词并迭代。
zimage-skill
Generate images using ModelScope Z-Image-Turbo API. Use when user asks to generate, create, or make images, pictures, or illustrations.
qwen-image
Generate and edit images with Alibaba Qwen-Image-2.0 models via inference.sh CLI. Models: Qwen-Image-2.0 (fast), Qwen-Image-2.0-Pro (professional text rendering). Capabilities: text-to-image, multi-image editing, complex text rendering. Triggers: qwen image, qwen-image, alibaba image, dashscope image, qwen image 2, qwen image pro
qwen-image-pro
Generate images with Alibaba Qwen-Image-2.0-Pro via inference.sh CLI. Professional text rendering, fine-grained realism, enhanced semantic adherence. Ideal for posters, banners, and text-heavy designs. Triggers: qwen image pro, qwen-image-pro, qwen 2 pro, alibaba image pro, dashscope pro, professional text rendering