Update gen-image skill specs
This commit is contained in:
+33
-8
@@ -1,11 +1,11 @@
|
||||
---
|
||||
name: gen-image
|
||||
description: 调用大模型中转站的 OpenAI 图片接口生图(文生图、图生图/编辑、局部重绘、透明背景)。触发词:生图、生成图片、画一张、AI 画图、文生图、图生图、生成插画/头像/海报/图标、image generation、根据这张图改。需要外部 API 生成位图图像时使用;纯 HTML/SVG/矢量设计不适用。
|
||||
description: 调用大模型中转站的 OpenAI 图片接口生图(文生图、图生图/编辑、局部重绘、透明背景)。支持 1K/2K/4K 常用尺寸规格、横竖方比例、质量、背景和可选 style 风格参数。触发词:生图、生成图片、画一张、AI 画图、文生图、图生图、生成插画/头像/海报/封面/壁纸/图标、image generation、根据这张图改。需要外部 API 生成位图图像时使用;纯 HTML/SVG/矢量设计不适用。
|
||||
---
|
||||
|
||||
# gen-image · 生图
|
||||
|
||||
通过大模型中转站,直接调用 OpenAI 图片接口生成位图图像。支持**文生图**、**图生图/编辑**、**局部重绘(mask)**、**透明背景**。
|
||||
通过大模型中转站,直接调用 OpenAI 图片接口生成位图图像。支持**文生图**、**图生图/编辑**、**局部重绘(mask)**、**透明背景**、**1K/2K/4K 常用尺寸**和**可选 style 风格参数**。
|
||||
|
||||
核心是零依赖脚本 `scripts/gen_image.py`(纯 Python 标准库,无需 pip install)。
|
||||
|
||||
@@ -41,9 +41,10 @@ cp .env.example .env
|
||||
**1. 打磨提示词。** 用户给的描述往往简短,先在心里扩写成一句信息充分的英文或中文提示词——主体、风格、光线、构图、色调、画质关键词。除非用户明确要求逐字使用,否则主动增强。生图模型对细节敏感,「一只猫」远不如「a fluffy orange tabby cat sitting on a windowsill, soft morning light, shallow depth of field, cozy warm tones」。
|
||||
|
||||
**2. 选参数:**
|
||||
- `--size`:`1024x1024`(方,头像/图标)、`1536x1024`(横,海报/封面)、`1024x1536`(竖,手机壁纸/人像)、`auto`
|
||||
- `--size`:支持直接传像素值或别名。默认 `1024x1024`;常用别名见「尺寸规格速查」。
|
||||
- `--quality`:`low`/`medium`/`high`/`auto`(gpt-image 系支持;越高越慢越贵)
|
||||
- `--background transparent`:要透明底的图标/贴纸时加
|
||||
- `--style`:部分模型/中转支持的独立风格参数,如 `vivid`、`natural`、`anime`、`photorealistic`。若上游不支持,把风格写进 prompt。
|
||||
- `--n`:一次出几张(默认 1;多给几张让用户挑时用 `--n 2` 或 `4`)
|
||||
|
||||
**3. 执行(文生图):**
|
||||
@@ -51,7 +52,7 @@ cp .env.example .env
|
||||
```bash
|
||||
cd "<skill 根目录>" && python3 scripts/gen_image.py \
|
||||
"a fluffy orange tabby cat on a windowsill, soft morning light, cozy tones, highly detailed" \
|
||||
--size 1024x1024 --quality high
|
||||
--size 1k-square --quality high
|
||||
```
|
||||
|
||||
图片存到 `output/img-<时间戳>-<序号>.png`,脚本会打印完整路径。
|
||||
@@ -59,23 +60,47 @@ cd "<skill 根目录>" && python3 scripts/gen_image.py \
|
||||
**4. 图生图 / 编辑**(用户给了输入图):
|
||||
|
||||
```bash
|
||||
python3 scripts/gen_image.py "把背景换成雪山日落" --edit /path/to/input.png --size 1024x1024
|
||||
python3 scripts/gen_image.py "把背景换成雪山日落" --edit /path/to/input.png --size 1k-square
|
||||
```
|
||||
|
||||
多图参考:多次 `--edit a.png --edit b.png`。局部重绘:加 `--mask mask.png`(PNG 中**透明区域**为要重绘的部分,其余保留)。
|
||||
|
||||
**5. 交付。** 打印出保存路径后,简要告诉用户生成了什么、存在哪。图无法在终端直接显示,用户会自己打开;若在支持预览的环境可提示路径。
|
||||
|
||||
## 尺寸规格速查
|
||||
|
||||
脚本会把下列别名转换为实际像素;也可以直接传 `WIDTHxHEIGHT` 或 `auto`。部分中转/模型可能只开放其中一部分规格,遇到 400 时降低到 1K 或改用上游明确支持的尺寸。
|
||||
|
||||
| 规格 | 方图 | 横图 | 竖图 | 宽屏/超宽 | 典型用途 |
|
||||
|------|------|------|------|-----------|----------|
|
||||
| 1K | `1k-square` → `1024x1024` | `1k-landscape` → `1536x1024` | `1k-portrait` → `1024x1536` | - | 头像、图标、草图、普通配图 |
|
||||
| 2K | `2k-square` → `2048x2048` | `2k-landscape` → `2048x1536` | `2k-portrait` → `1536x2048` | `2k-wide` → `2048x1152` / `2k-tall` → `1152x2048` | 海报、封面、高清社媒图 |
|
||||
| 4K | `4k-square` → `4096x4096` | `4k-landscape` → `4096x3072` | `4k-portrait` → `3072x4096` | `4k-wide` → `4096x2304` / `4k-uhd` → `3840x2160` / `4k-tall` → `2304x4096` / `4k-uhd-portrait` → `2160x3840` | 大屏封面、展板、高清壁纸 |
|
||||
|
||||
## 风格参数速查
|
||||
|
||||
优先把风格写进 prompt,因为所有模型都能理解自然语言风格。仅当目标中转或模型明确支持独立风格字段时,再额外传 `--style`。
|
||||
|
||||
| 需求 | 推荐写法 |
|
||||
|------|---------|
|
||||
| 写实摄影 | prompt 写 `photorealistic, cinematic lighting, natural skin texture`,可加 `--style photorealistic` |
|
||||
| 插画 | prompt 写 `editorial illustration, clean shapes, rich color palette`,可加 `--style illustration` |
|
||||
| 动漫 | prompt 写 `anime style, expressive linework, cel shading`,可加 `--style anime` |
|
||||
| 自然风格 | prompt 写清现实光线和材质,可加 `--style natural` |
|
||||
| 鲜艳风格 | prompt 写高饱和、强对比,可加 `--style vivid` |
|
||||
|
||||
## 常见参数速查
|
||||
|
||||
| 需求 | 命令片段 |
|
||||
|------|---------|
|
||||
| 头像/图标(方图) | `--size 1024x1024` |
|
||||
| 海报/封面(横) | `--size 1536x1024` |
|
||||
| 手机壁纸/人像(竖) | `--size 1024x1536` |
|
||||
| 头像/图标(方图) | `--size 1k-square` 或 `--size 1024x1024` |
|
||||
| 海报/封面(横) | `--size 1k-landscape` / `2k-landscape` / `4k-wide` |
|
||||
| 手机壁纸/人像(竖) | `--size 1k-portrait` / `2k-portrait` / `4k-tall` |
|
||||
| 4K 壁纸 | `--size 4k-uhd` |
|
||||
| 透明背景贴纸 | `--background transparent` |
|
||||
| 多出几张挑选 | `--n 4` |
|
||||
| 高画质 | `--quality high` |
|
||||
| 独立风格字段 | `--style natural` 或 `--style vivid`(看上游支持情况) |
|
||||
| 换模型 | `--model dall-e-3` |
|
||||
| 基于图改 | `--edit input.png` |
|
||||
| 局部重绘 | `--edit input.png --mask mask.png` |
|
||||
|
||||
Reference in New Issue
Block a user