关于 gpt-image-edit
gpt-image-edit 是通过 RunComfy Model API 使用 GPT Image 2 编辑端点的图像编辑技能,适合需要保留主体与版式、精确修改图中文字或场景的用户。它支持多语言文字编辑及最多 10 张参考图。
主要功能
- 01编辑图像中的多语言文字
- 02最多 10 张参考图
- 03保留主体身份与版式
- 04按方向描述调整元素位置
- 05支持自动保留原图比例
适用场景
- 01为广告替换不同语言的标题
- 02调整海报中的标题或 CTA
- 03组合不同参考图中的主体与场景
MCP 相关
这是调用 RunComfy Model API 的技能,不是 MCP 服务;RunComfy CLI 提交图像编辑任务并下载结果。
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ runcomfy-com/ skills --skill gpt-image-edit安装后在 Claude Code 中输入/gpt-image-edit确认已加载。
详细介绍
GPT Image Edit — RunComfy 专业版
runcomfy.com · 编辑端点 · 文生图同系列模型 · GitHub
RunComfy Model API 上的 OpenAI GPT Image 2 — /edit 端点(ChatGPT Images 2.0 图生图)。它在同类模型中最擅长通过定向编辑保留身份特征,以及重写图像中任何文字体系(拉丁字母、假名、中日韩文字、西里尔字母、阿拉伯文)的嵌入文字。
npx skills add agentspace-so/runcomfy-skills --skill gpt-image-edit -g
何时选择此模型(而非同系列其他模型)
| 需求 | 使用 |
|---|---|
| 编辑图像中的多语言/嵌入文字 | GPT Image Edit |
| 在翻译标题的不同版本中保留身份特征 | GPT Image Edit |
| 精准编辑布局(移动标题、更换 CTA 等) | GPT Image Edit |
| 最多使用 10 张参考图 | GPT Image Edit |
| 一致地批量处理最多 20 张图像 | Nano Banana Edit |
| 单次精确局部编辑,优先忠实还原来源 | Flux Kontext |
| 使用 GPT Image 2 从零生成 | 同系列 gpt-image-2 技能 |
| 批量生成身份特征稳定的 SKU 图集 | Nano Banana Edit |
前提条件
- RunComfy CLI —
npm i -g @runcomfy/cli - RunComfy 账户 —
runcomfy login会打开浏览器设备代码登录流程。 - CI/容器 — 设置
RUNCOMFY_TOKEN=<token>,而不是运行runcomfy login。
端点和输入架构
openai/gpt-image-2/edit
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
prompt | string | 是 | — | 编辑指令。先说明要保留的内容,最后说明要做的改动。 |
images | string[] | 是 | — | 最多 10 个可公开获取的 HTTPS URL。第一个是主图,其余为辅助图。 |
size | enum | 否 | auto | auto(保留输入图像)、1024_1024(1:1)、1024_1536(2:3 纵向)、1536_1024(3:2 横向)。 |
size=auto 会保留输入图像的比例——除非编辑明确要求更改取景范围,否则强烈建议使用此设置。
调用方法
保留单张参考图的编辑:
runcomfy run openai/gpt-image-2/edit \
--input '{
"prompt": "Keep the person'\''s face, pose, and brand mark unchanged. Replace the background with a soft warm-grey studio sweep and a gentle floor shadow.",
"images": ["https://.../portrait.jpg"]
}' \
--output-dir <absolute/path>
多语言文字改写(除标题外保留所有内容):
runcomfy run openai/gpt-image-2/edit \
--input '{
"prompt": "Keep the photograph, layout, and brand mark exactly as in the input. Replace only the in-image headline. The new headline reads \"今日のおすすめ\" in bold Japanese kana, same position and font weight as before.",
"images": ["https://.../poster-en.jpg"]
}' \
--output-dir <absolute/path>
多参考图合成:
runcomfy run openai/gpt-image-2/edit \
--input '{
"prompt": "Compose subject from image 1 into the room from image 2. Match the lighting and color palette of image 2. Keep image 1 subject identity (face, pose, clothing) unchanged.",
"images": ["https://.../subject.jpg", "https://.../room.jpg"]
}' \
--output-dir <absolute/path>
提示词——实际有效的方法
先说明保留目标。 务必先写:"Keep [face / pose / clothing / brand / framing] unchanged.",然后说明要做的改动。模型会优先遵循开头的要求。
多语言文字——引用字符并注明文字体系。 "the headline reads \"コーヒー\" in bold Japanese kana"、"the label says \"АРОМА\" in Cyrillic, white on black"、"the right-margin caption reads \"تخفيض\" in Arabic right-to-left"。不要转述——直接引用。
空间编辑使用方向性描述。 具体的空间范围描述效果很好:"move the headline from top-right to bottom-center"、"remove the leftmost object only"、"replace the watermark in the bottom-right corner"。
多参考图编号。 传入多张 images 时,按编号引用它们:"subject from image 1, lighting from image 2, color palette from image 3"。模型能够正确分配提示信息。
使用 size: "auto" 保留输入比例。 只有编辑明确要求更改取景范围时才覆盖此设置(例如将 16:9 图像裁剪为 1:1)。
反模式:
- 过长的复合编辑指令(“更改 A、B、C 和 D”)→ 每增加一个编辑目标,偏移风险都会增大。
- 未说明保留目标 → 模型可能会微妙地改写面部、品牌或取景范围。
- 转述而非引用图像中的文字 → 输出文字会有所不同。
- 将
size设为 3 个固定值和auto以外的值 → 422。
适用场景
| 使用场景 | GPT Image Edit 的优势 |
|---|---|
| 多语言广告本地化 | 一个源素材 → 同一标题的多种语言版本 |
| 符合品牌规范的标题 / CTA 替换 | 精确的布局控制 + 保留指令,让其余部分保持稳定 |
| 多参考图合成(主体取自一张图,场景取自另一张图) | 编号参考图可准确传递线索 |
| 精确调整布局位置 | 能遵循方向性描述(“从右上角移至底部中央”) |
| 编辑标牌时保留身份特征 | 在针对性编辑中,面部 / 品牌保留能力同类最佳 |
示例提示词(经验证可生成优质结果)
替换背景并完整保留其他内容(页面示例):
Turn the background into a bright minimal white-to-soft-gray studio
sweep with gentle floor shadow; add a large headline in-image that
reads "OPEN STUDIO" in a bold clean sans-serif, high contrast, centered;
keep the main person or product, pose, and face identity unchanged
多语言版本:
Keep the photograph, layout, lighting, and brand mark exactly as in the
input. Replace only the in-image headline.
The new headline reads "コーヒー" in bold Japanese kana, same position
and font weight as before.
多参考图合成:
Compose subject from image 1 into the kitchen from image 2.
Match the warm window light and color palette of image 2.
Keep subject identity (face, pose, clothing) from image 1 unchanged.
局限性
size:3 个固定值 +auto— 其他值都会返回 422 错误。images:最多 10 张 — 第一张是主图,其余为辅助线索。- 较长的复合提示词容易偏离 — 必要时拆分为多个处理步骤。
- 要在大量 SKU 图片中保持批次一致性,Nano Banana Edit(最多 20 张)更合适。
- 人像写实度方面 — Nano Banana Pro 更胜一筹。
退出代码
| code | 含义 |
|---|---|
| 0 | 成功 |
| 64 | CLI 参数错误 |
| 65 | 输入 JSON 错误 / 架构不匹配 |
| 69 | 上游 5xx 错误 |
| 75 | 可重试:超时 / 429 |
| 77 | 未登录或令牌遭拒 |
完整参考:docs.runcomfy.com/cli/troubleshooting。
工作原理
该技能使用符合架构的 JSON 请求体调用 runcomfy run openai/gpt-image-2/edit。CLI 会向 https://model-api.runcomfy.net/v1/models/openai/gpt-image-2/edit 发送 POST 请求,轮询请求状态,获取结果,并将任何 .runcomfy.net/.runcomfy.com URL 下载到 --output-dir。按下 Ctrl-C 会在退出前取消远程请求。
安全与隐私
- 令牌存储:
runcomfy login会将 API 令牌写入~/.config/runcomfy/token.json,文件权限为 0600(仅所有者可读写)。在 CI / 容器中设置RUNCOMFY_TOKEN环境变量即可完全绕过该文件。 - 输入边界:用户提示词会作为 JSON 字符串通过
--input传递给 CLI。CLI 不会对提示词进行 shell 展开,而是通过 HTTPS 直接传输 JSON 请求体至模型 API。提示词内容不存在 shell 注入风险。 - 第三方内容:你提供的图片 / 遮罩 / 视频 URL 由 RunComfy 模型服务获取,而不是由你机器上的 CLI 获取。请将外部 URL 视为不可信内容;基于图片的提示词注入是任何图片编辑 / 视频编辑模型都存在的已知风险。
- 出站端点:仅使用
model-api.runcomfy.net(提交请求)和*.runcomfy.net/*.runcomfy.com(生成结果的下载白名单)。无遥测,无回调。 - 生成文件大小上限:CLI 会中止任何超过 2 GiB 的单个下载,以防恶意或失控的模型输出耗尽磁盘空间。