gpt-image-1-5

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GPT Image 1.5 - Image Generation & Editing

GPT Image 1.5 - 图片生成与编辑

Generate new images or edit existing ones using OpenAI's GPT Image 1.5 model.
  • Generation: Uses the Responses API with image_generation tool
  • Editing: Uses the Image API for reliable mask-based inpainting
使用OpenAI的GPT Image 1.5模型生成新图片或编辑现有图片。
  • 生成:使用Responses API和image_generation工具
  • 编辑:使用Image API实现可靠的基于蒙版的图像修复

Usage

使用方法

Run the script using absolute path (do NOT cd to skill directory first):
Generate new image:
bash
uv run ~/.claude/skills/gpt-image-1-5/scripts/generate_image.py --prompt "your image description" --filename "output-name.png" [--quality low|medium|high] [--size 1024x1024|1024x1536|1536x1024|auto] [--background transparent|opaque|auto] [--api-key KEY]
Edit existing image (without mask - full image edit):
bash
uv run ~/.claude/skills/gpt-image-1-5/scripts/generate_image.py --prompt "editing instructions" --filename "output-name.png" --input-image "path/to/input.png" [--size 1024x1024|1024x1536|1536x1024|auto] [--api-key KEY]
Edit existing image (with mask - precise inpainting):
bash
uv run ~/.claude/skills/gpt-image-1-5/scripts/generate_image.py --prompt "what to put in masked area" --filename "output-name.png" --input-image "path/to/input.png" --mask "path/to/mask.png" [--size 1024x1024|1024x1536|1536x1024|auto] [--api-key KEY]
Important: Always run from the user's current working directory so images are saved where the user is working, not in the skill directory.
使用绝对路径运行脚本(请勿先切换到技能目录):
生成新图片:
bash
uv run ~/.claude/skills/gpt-image-1-5/scripts/generate_image.py --prompt "your image description" --filename "output-name.png" [--quality low|medium|high] [--size 1024x1024|1024x1536|1536x1024|auto] [--background transparent|opaque|auto] [--api-key KEY]
编辑现有图片(无蒙版 - 全图编辑):
bash
uv run ~/.claude/skills/gpt-image-1-5/scripts/generate_image.py --prompt "editing instructions" --filename "output-name.png" --input-image "path/to/input.png" [--size 1024x1024|1024x1536|1536x1024|auto] [--api-key KEY]
编辑现有图片(带蒙版 - 精准修复):
bash
uv run ~/.claude/skills/gpt-image-1-5/scripts/generate_image.py --prompt "what to put in masked area" --filename "output-name.png" --input-image "path/to/input.png" --mask "path/to/mask.png" [--size 1024x1024|1024x1536|1536x1024|auto] [--api-key KEY]
重要提示: 始终从用户当前工作目录运行,以便图片保存到用户的工作目录,而非技能目录。

Parameters

参数说明

Quality Options

质量选项

  • low - Fastest generation, lower quality
  • medium (default) - Balanced quality and speed
  • high - Best quality, slower generation
Map user requests:
  • No mention of quality ->
    medium
  • "quick", "fast", "draft" ->
    low
  • "high quality", "best", "detailed", "high-res" ->
    high
  • low - 生成速度最快,质量较低
  • medium(默认)- 质量与速度平衡
  • high - 质量最佳,生成速度较慢
用户请求映射:
  • 未提及质量 ->
    medium
  • “快速”、“极速”、“草稿” ->
    low
  • “高质量”、“最佳”、“细节丰富”、“高分辨率” ->
    high

Size Options

尺寸选项

  • 1024x1024 (default) - Square format
  • 1024x1536 - Portrait format
  • 1536x1024 - Landscape format
  • auto - Let the model decide based on prompt
Map user requests:
  • No mention of size ->
    1024x1024
  • "square" ->
    1024x1024
  • "portrait", "vertical", "tall" ->
    1024x1536
  • "landscape", "horizontal", "wide" ->
    1536x1024
  • 1024x1024(默认)- 正方形格式
  • 1024x1536 - 竖版格式
  • 1536x1024 - 横版格式
  • auto - 由模型根据提示自行决定
用户请求映射:
  • 未提及尺寸 ->
    1024x1024
  • “正方形” ->
    1024x1024
  • “竖版”、“纵向”、“高型” ->
    1024x1536
  • “横版”、“横向”、“宽型” ->
    1536x1024

Background Options (generation only)

背景选项(仅生成模式)

  • auto (default) - Model decides
  • transparent - Transparent background (PNG/WebP output)
  • opaque - Solid background
  • auto(默认)- 由模型决定
  • transparent - 透明背景(输出PNG/WebP格式)
  • opaque - 纯色背景

API Key

API密钥

The script checks for API key in this order:
  1. --api-key
    argument (use if user provided key in chat)
  2. OPENAI_API_KEY
    environment variable
If neither is available, the script exits with an error message.
脚本将按以下顺序检查API密钥:
  1. --api-key
    参数(如果用户在对话中提供了密钥)
  2. OPENAI_API_KEY
    环境变量
如果两者都不可用,脚本将退出并显示错误信息。

Filename Generation

文件名生成

Generate filenames with the pattern:
yyyy-mm-dd-hh-mm-ss-name.png
Format:
{timestamp}-{descriptive-name}.png
  • Timestamp: Current date/time in format
    yyyy-mm-dd-hh-mm-ss
    (24-hour format)
  • Name: Descriptive lowercase text with hyphens
  • Keep the descriptive part concise (1-5 words typically)
  • Use context from user's prompt or conversation
  • If unclear, use random identifier (e.g.,
    x9k2
    ,
    a7b3
    )
Examples:
  • Prompt "A serene Japanese garden" ->
    2025-12-17-14-23-05-japanese-garden.png
  • Prompt "sunset over mountains" ->
    2025-12-17-15-30-12-sunset-mountains.png
  • Prompt "create an image of a robot" ->
    2025-12-17-16-45-33-robot.png
  • Unclear context ->
    2025-12-17-17-12-48-x9k2.png
按照以下模式生成文件名:
yyyy-mm-dd-hh-mm-ss-name.png
格式:
{timestamp}-{descriptive-name}.png
  • 时间戳:当前日期/时间,格式为
    yyyy-mm-dd-hh-mm-ss
    (24小时制)
  • 名称:描述性小写文本,用连字符分隔
  • 描述部分保持简洁(通常1-5个词)
  • 使用用户提示或对话中的上下文
  • 如果上下文不明确,使用随机标识符(例如:
    x9k2
    ,
    a7b3
示例:
  • 提示“宁静的日本园林” ->
    2025-12-17-14-23-05-japanese-garden.png
  • 提示“山间日落” ->
    2025-12-17-15-30-12-sunset-mountains.png
  • 提示“创建一张机器人图片” ->
    2025-12-17-16-45-33-robot.png
  • 上下文不明确 ->
    2025-12-17-17-12-48-x9k2.png

Image Editing

图片编辑

Both editing modes use the Image API (images.edit endpoint) with gpt-image-1.5 for reliable results.
两种编辑模式均使用Image API(images.edit端点)和gpt-image-1.5以获得可靠结果。

Without Mask (Full Image Edit)

无蒙版(全图编辑)

When the user wants to modify an existing image without specifying exact regions:
  1. Use
    --input-image
    parameter with the path to the image
  2. The prompt should contain editing instructions (e.g., "make the sky more dramatic", "change to cartoon style")
  3. A fully transparent mask is auto-generated, allowing the model to edit the entire image
当用户想要修改现有图片但未指定具体区域时:
  1. 使用
    --input-image
    参数传入图片路径
  2. 提示中应包含编辑指令(例如:“让天空更有戏剧性”、“改为卡通风格”)
  3. 自动生成全透明蒙版,允许模型编辑整张图片

With Mask (Precise Inpainting)

带蒙版(精准修复)

When the user wants to edit specific regions:
  1. Use
    --input-image
    parameter with the path to the image
  2. Use
    --mask
    parameter with a PNG mask file
  3. The mask should have transparent areas (alpha=0) where edits should occur
  4. The prompt describes what should appear in the masked region
Common editing tasks: add/remove elements, change style, adjust colors, replace backgrounds, etc.
当用户想要编辑特定区域时:
  1. 使用
    --input-image
    参数传入图片路径
  2. 使用
    --mask
    参数传入PNG蒙版文件
  3. 蒙版中透明区域(alpha=0)即为需要编辑的区域
  4. 提示描述蒙版区域应呈现的内容
常见编辑任务:添加/移除元素、更改风格、调整颜色、更换背景等。

Prompt Handling

提示处理

For generation: Pass user's image description as-is to
--prompt
. Only rework if clearly insufficient.
For editing: Pass editing instructions in
--prompt
(e.g., "add a rainbow in the sky", "make it look like a watercolor painting")
Preserve user's creative intent in both cases.
生成模式: 将用户的图片描述直接传入
--prompt
。仅当描述明显不充分时才进行调整。
编辑模式: 将编辑指令传入
--prompt
(例如:“在天空中添加彩虹”、“改成水彩画风格”)
两种模式均需保留用户的创作意图。

Output

输出

  • Saves PNG to current directory (or specified path if filename includes directory)
  • Script outputs the full path to the generated image
  • Do not read the image back - just inform the user of the saved path
  • 将PNG图片保存到当前目录(如果文件名包含路径则保存到指定路径)
  • 脚本会输出生成图片的完整路径
  • 请勿回读图片 - 只需告知用户保存路径即可

Examples

示例

Generate new image:
bash
uv run ~/.claude/skills/gpt-image-1-5/scripts/generate_image.py --prompt "A serene Japanese garden with cherry blossoms" --filename "2025-12-17-14-23-05-japanese-garden.png" --quality high --size 1536x1024
Generate with transparent background:
bash
uv run ~/.claude/skills/gpt-image-1-5/scripts/generate_image.py --prompt "A cute cartoon cat mascot" --filename "2025-12-17-14-25-30-cat-mascot.png" --background transparent --quality high
Edit existing image (full image):
bash
uv run ~/.claude/skills/gpt-image-1-5/scripts/generate_image.py --prompt "make the sky more dramatic with storm clouds" --filename "2025-12-17-14-27-00-dramatic-sky.png" --input-image "original-photo.jpg"
Edit with mask (inpainting):
bash
uv run ~/.claude/skills/gpt-image-1-5/scripts/generate_image.py --prompt "a flamingo swimming" --filename "2025-12-17-14-30-00-lounge-flamingo.png" --input-image "lounge.png" --mask "mask.png"
生成新图片:
bash
uv run ~/.claude/skills/gpt-image-1-5/scripts/generate_image.py --prompt "A serene Japanese garden with cherry blossoms" --filename "2025-12-17-14-23-05-japanese-garden.png" --quality high --size 1536x1024
生成带透明背景的图片:
bash
uv run ~/.claude/skills/gpt-image-1-5/scripts/generate_image.py --prompt "A cute cartoon cat mascot" --filename "2025-12-17-14-25-30-cat-mascot.png" --background transparent --quality high
编辑现有图片(全图):
bash
uv run ~/.claude/skills/gpt-image-1-5/scripts/generate_image.py --prompt "make the sky more dramatic with storm clouds" --filename "2025-12-17-14-27-00-dramatic-sky.png" --input-image "original-photo.jpg"
带蒙版编辑(图像修复):
bash
uv run ~/.claude/skills/gpt-image-1-5/scripts/generate_image.py --prompt "a flamingo swimming" --filename "2025-12-17-14-30-00-lounge-flamingo.png" --input-image "lounge.png" --mask "mask.png"