OpenAI Image Gen
Generate a handful of “random but structured” prompts and render them via the OpenAI Images API.
Run
Note: Image generation can take longer than common exec timeouts (for example 30 seconds).
When invoking this skill via OpenClaw’s exec tool, set a higher timeout to avoid premature termination/retries (e.g., exec timeout=300).
CODEBLOCK0
Useful flags:
CODEBLOCK1
Model-Specific Parameters
Different models support different parameter values. The script automatically selects appropriate defaults based on the model.
Size
- - GPT image models (
gpt-image-1, gpt-image-1-mini, gpt-image-1.5): 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), or INLINECODE6
- Default:
1024x1024
- - dall-e-3:
1024x1024, 1792x1024, or INLINECODE10
- Default:
1024x1024
- - dall-e-2:
256x256, 512x512, or INLINECODE14
- Default: INLINECODE15
Quality
- - GPT image models:
auto, high, medium, or INLINECODE19
- Default:
high
- - dall-e-3:
hd or INLINECODE22
- Default:
standard
- - dall-e-2:
standard only
- Default: INLINECODE25
Other Notable Differences
- - dall-e-3 only supports generating 1 image at a time (
n=1). The script automatically limits count to 1 when using this model. - GPT image models support additional parameters:
-
--background:
transparent,
opaque, or
auto (default)
-
--output-format:
png (default),
jpeg, or
webp
- Note:
stream and
moderation are available via API but not yet implemented in this script
- - dall-e-3 has a
--style parameter: vivid (hyper-real, dramatic) or natural (more natural looking)
Output
- -
*.png, *.jpeg, or *.webp images (output format depends on model + --output-format) - INLINECODE44 (prompt → file mapping)
- INLINECODE45 (thumbnail gallery)
OpenAI 图像生成
生成一批“随机但有结构”的提示词,并通过 OpenAI 图像 API 进行渲染。
运行
注意:图像生成所需时间可能超过常见的执行超时时间(例如 30 秒)。
通过 OpenClaw 的 exec 工具调用此技能时,请设置更高的超时时间以避免提前终止或重试(例如,exec timeout=300)。
bash
python3 {baseDir}/scripts/gen.py
open ~/Projects/tmp/openai-image-gen-*/index.html # 如果 ~/Projects/tmp 存在;否则使用 ./tmp/...
常用参数:
bash
GPT 图像模型,支持多种选项
python3 {baseDir}/scripts/gen.py --count 16 --model gpt-image-1
python3 {baseDir}/scripts/gen.py --prompt 超精细摄影棚照片:龙虾宇航员 --count 4
python3 {baseDir}/scripts/gen.py --size 1536x1024 --quality high --out-dir ./out/images
python3 {baseDir}/scripts/gen.py --model gpt-image-1.5 --background transparent --output-format webp
DALL-E 3(注意:count 自动限制为 1)
python3 {baseDir}/scripts/gen.py --model dall-e-3 --quality hd --size 1792x1024 --style vivid
python3 {baseDir}/scripts/gen.py --model dall-e-3 --style natural --prompt 宁静的山景
DALL-E 2
python3 {baseDir}/scripts/gen.py --model dall-e-2 --size 512x512 --count 4
模型特定参数
不同模型支持不同的参数值。脚本会根据模型自动选择合适的默认值。
尺寸
- - GPT 图像模型(gpt-image-1、gpt-image-1-mini、gpt-image-1.5):1024x1024、1536x1024(横向)、1024x1536(纵向)或 auto
- 默认值:1024x1024
- - dall-e-3:1024x1024、1792x1024 或 1024x1792
- 默认值:1024x1024
- - dall-e-2:256x256、512x512 或 1024x1024
- 默认值:1024x1024
质量
- - GPT 图像模型:auto、high、medium 或 low
- 默认值:high
- 默认值:standard
- 默认值:standard
其他显著差异
- - dall-e-3 每次仅支持生成 1 张图像(n=1)。使用此模型时,脚本会自动将 count 限制为 1。
- GPT 图像模型支持额外参数:
- --background:transparent、opaque 或 auto(默认)
- --output-format:png(默认)、jpeg 或 webp
- 注意:stream 和 moderation 可通过 API 使用,但尚未在此脚本中实现
- - dall-e-3 具有 --style 参数:vivid(超写实、戏剧化)或 natural(更自然的外观)
输出
- - .png、.jpeg 或 *.webp 图像(输出格式取决于模型 + --output-format)
- prompts.json(提示词 → 文件映射)
- index.html(缩略图画廊)