image-edit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImage Edit — Pro Pack on RunComfy
RunComfy 图像编辑专业套件
Image edit, intent-routed. This skill doesn't lock you to one model — it picks the right edit model in the RunComfy catalog based on what the user actually wants: batch identity-preservation, multilingual text rewrite, single-shot precise edit, or mask-driven region replacement.
bash
npx skills add agentspace-so/runcomfy-skills --skill image-edit -g基于意图路由的图像编辑。该技能不会限制你使用单一模型——它会根据用户的实际需求,从RunComfy模型库中挑选合适的编辑模型:批量保留主体特征、多语言文字改写、单指令精准编辑或基于蒙版的区域替换。
bash
npx skills add agentspace-so/runcomfy-skills --skill image-edit -gPick the right model for the user's intent
根据用户意图选择合适模型
| User intent | Model | Why |
|---|---|---|
| Batch edit 1–20 images consistently (SKU gallery, A/B variants) | Nano Banana Edit | Up to 20 input images per call; locked aspect/resolution for series |
| Swap background, preserve subject identity | Nano Banana Edit | Strong identity preservation under "keep X unchanged" prompts |
| Localized object removal / addition with spatial language ("the left object", "upper-right corner") | Nano Banana Edit | Honors directional spatial scope |
| Multilingual / non-Latin in-image text rewrite (Japanese kana, Cyrillic, Arabic) | GPT Image 2 Edit | Strongest in class for multilingual typography |
| Multi-reference composition (subject from img1, scene from img2, palette from img3) | GPT Image 2 Edit | Numbered refs route cues correctly |
| Layout-precise repositioning ("move headline from top-right to bottom-center") | GPT Image 2 Edit | Directional language honored at layout level |
| Identity preservation across translated headline variants | GPT Image 2 Edit | Same source asset → many language variants, identity stable |
| Single-shot precise local edit ("she's now holding an orange umbrella") | Flux Kontext Pro | Single-ref single-instruction, high-fidelity preservation |
| Mask-driven object removal (cables, watermarks, distractions) | Z-Image Turbo Inpaint | Mask-required, strength-tunable, edge-consistent |
| Mask-driven region replacement (full background swap with mask) | Z-Image Turbo Inpaint | High strength + clean mask = clean replacement |
| Default if unspecified | Nano Banana Edit | Most flexible, supports both single and batch |
The agent reads this table, classifies the user's intent, and picks the matching subsection below.
| 用户意图 | 模型 | 选择理由 |
|---|---|---|
| 批量编辑1-20张图片并保持一致性(SKU图库、A/B测试变体) | Nano Banana Edit | 每次调用最多支持20张输入图片;可锁定宽高比/分辨率以保证系列一致性 |
| 替换背景,保留主体特征 | Nano Banana Edit | 在“保持X不变”的提示下,主体特征保留能力出色 |
| 使用空间语言进行局部物体移除/添加(“左侧物体”“右上角”) | Nano Banana Edit | 可识别并遵循方向性空间范围 |
| 多语言/非拉丁语系图像内文字改写(日文假名、西里尔字母、阿拉伯语) | GPT Image 2 Edit | 多语言排版能力业内领先 |
| 多参考图合成(主体来自图1,场景来自图2,调色来自图3) | GPT Image 2 Edit | 可通过编号参考图正确传递线索 |
| 布局精准重定位(“将标题从右上角移至底部中央”) | GPT Image 2 Edit | 可在布局层面遵循方向性语言指令 |
| 翻译标题变体时保留主体特征 | GPT Image 2 Edit | 同一源素材生成多语言变体,主体特征保持稳定 |
| 单指令精准局部编辑(“她现在手持一把橙色雨伞”) | Flux Kontext Pro | 单参考图单指令,高保真保留原有特征 |
| 基于蒙版的物体移除(线缆、水印、干扰元素) | Z-Image Turbo Inpaint | 需配合蒙版使用,强度可调,边缘过渡自然 |
| 基于蒙版的区域替换(通过蒙版完全替换背景) | Z-Image Turbo Inpaint | 高强度蒙版可实现干净的替换效果 |
| 用户未指定时的默认选择 | Nano Banana Edit | 灵活性最高,支持单张和批量编辑 |
智能代理会读取此表格,对用户意图进行分类,并选择对应的操作路径。
Prerequisites
前置条件
- RunComfy CLI —
npm i -g @runcomfy/cli - RunComfy account — .
runcomfy login - CI / containers — set .
RUNCOMFY_TOKEN=<token>
- RunComfy CLI —
npm i -g @runcomfy/cli - RunComfy账户 —
runcomfy login - CI/容器环境 — 设置环境变量
RUNCOMFY_TOKEN=<token>
Route 1: Nano Banana Edit — default for general edit + batch
路径1:Nano Banana Edit — 通用编辑和批量编辑默认选择
Model:
google/nano-banana-2/edit模型:
google/nano-banana-2/editSchema
参数 schema
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| string | yes | — | Lead with preservation goals, end with the change. |
| array | yes | — | 1–20 publicly-fetchable HTTPS URLs. |
| int | no | 1 | 1–4 outputs per call. |
| enum | no | | |
| enum | no | | |
| enum | no | | |
| int | no | — | Reproducibility. |
| bool | no | false | Web-grounded edits (extra latency). |
| 字段 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| 字符串 | 是 | — | 先说明需要保留的内容,再描述修改需求 |
| 数组 | 是 | — | 1-20个可公开访问的HTTPS图片链接 |
| 整数 | 否 | 1 | 每次调用可生成1-4张输出图片 |
| 枚举值 | 否 | | |
| 枚举值 | 否 | | |
| 枚举值 | 否 | | |
| 整数 | 否 | — | 用于生成结果可复现 |
| 布尔值 | 否 | false | 基于网络搜索的编辑(会增加延迟) |
Invoke
调用示例
bash
runcomfy run google/nano-banana-2/edit \
--input '{
"prompt": "Keep the subject identity, pose, and clothing unchanged. Convert the background into a rainy neon cyberpunk street.",
"image_urls": ["https://.../portrait.jpg"]
}' \
--output-dir <absolute/path>Batch (lock aspect + resolution):
bash
runcomfy run google/nano-banana-2/edit \
--input '{
"prompt": "Replace the watermark in the bottom-right with the text \"AURA\" in clean white sans-serif. Keep everything else exactly as in the input.",
"image_urls": ["https://.../sku-1.jpg", "https://.../sku-2.jpg", "https://.../sku-3.jpg"],
"aspect_ratio": "1:1",
"resolution": "1K"
}' \
--output-dir <absolute/path>bash
runcomfy run google/nano-banana-2/edit \
--input '{
"prompt": "保留主体身份、姿势和服装不变。将背景改为雨夜霓虹赛博朋克街道。",
"image_urls": ["https://.../portrait.jpg"]
}' \
--output-dir <absolute/path>批量编辑(锁定宽高比和分辨率):
bash
runcomfy run google/nano-banana-2/edit \
--input '{
"prompt": "将右下角的水印替换为干净的白色无衬线字体\"AURA\"。其他内容完全保持与输入一致。",
"image_urls": ["https://.../sku-1.jpg", "https://.../sku-2.jpg", "https://.../sku-3.jpg"],
"aspect_ratio": "1:1",
"resolution": "1K"
}' \
--output-dir <absolute/path>Prompting tips
提示技巧
- Preservation first: Then state the change.
"Keep [identity / pose / brand / framing] unchanged." - Spatial scope: "background only", "the left object", "upper-right quadrant" — concrete locations honored.
- Batch consistency: lock and
aspect_ratioacross the batch.resolution - Iterate small: split compound edits into multiple shorter passes.
- 先提保留需求:再说明修改内容
"保持[身份/姿势/品牌/构图]不变。" - 明确空间范围:“仅背景”“左侧物体”“右上象限”——具体位置指令会被遵循
- 批量一致性:批量编辑时锁定和
aspect_ratioresolution - 分步修改:将复杂编辑拆分为多个简短步骤
Route 2: GPT Image 2 Edit — multilingual text + multi-ref composition
路径2:GPT Image 2 Edit — 多语言文字+多参考图合成
Model:
openai/gpt-image-2/edit模型:
openai/gpt-image-2/editSchema
参数 schema
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| string | yes | — | Edit instruction; lead with preservation. |
| string[] | yes | — | Up to 10 HTTPS URLs. First is primary; rest are auxiliary. |
| enum | no | | |
| 字段 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| 字符串 | 是 | — | 编辑指令;先说明需要保留的内容 |
| 字符串数组 | 是 | — | 最多10个HTTPS链接。第一个是主图;其余为辅助参考图 |
| 枚举值 | 否 | | |
Invoke
调用示例
Multilingual text rewrite:
bash
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.",
"images": ["https://.../poster-en.jpg"]
}' \
--output-dir <absolute/path>Multi-ref composition:
bash
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 unchanged.",
"images": ["https://.../subject.jpg", "https://.../room.jpg"]
}' \
--output-dir <absolute/path>多语言文字改写:
bash
runcomfy run openai/gpt-image-2/edit \
--input '{
"prompt": "完全保留照片、布局和品牌标识。仅替换图像内的标题。新标题为粗体日文假名\"今日のおすすめ\",位置和字重与原标题一致。",
"images": ["https://.../poster-en.jpg"]
}' \
--output-dir <absolute/path>多参考图合成:
bash
runcomfy run openai/gpt-image-2/edit \
--input '{
"prompt": "将图1中的主体合成到图2的房间中。匹配图2的光线和调色板。保持图1主体身份不变。",
"images": ["https://.../subject.jpg", "https://.../room.jpg"]
}' \
--output-dir <absolute/path>Prompting tips
提示技巧
- Quote in-image text exactly. Name the script for non-Latin: ,
"Japanese kana","Cyrillic"."Arabic right-to-left" - Number multi-refs: .
"subject from image 1, lighting from image 2" - Directional layout language: ,
"move the headline from top-right to bottom-center"."replace the watermark in the bottom-right" - preserves input ratio — recommended unless the edit changes framing.
size: "auto"
- 准确引用图像内文字:非拉丁语系需注明文字类型:、
"日文假名"、"西里尔字母""阿拉伯语从右到左" - 给参考图编号:
"图1的主体,图2的光线" - 使用方向性布局语言:、
"将标题从右上角移至底部中央""替换右下角的水印" - 推荐使用:保留输入图片的比例——除非编辑需要改变构图
size: "auto"
Route 3: Flux Kontext Pro — single-shot precise local edit
路径3:Flux Kontext Pro — 单指令精准局部编辑
Model:
blackforestlabs/flux-1-kontext/pro/edit模型:
blackforestlabs/flux-1-kontext/pro/editSchema (minimal)
极简参数 schema
| Field | Type | Required | Notes |
|---|---|---|---|
| string | yes | One declarative edit instruction. |
| string | yes | Single source image URL. |
| enum | no | Pick from supported W:H values. |
| int | no | Reproducibility. |
Single image only — no array. For multi-image flows, use Route 1 (Nano Banana Edit).
| 字段 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| 字符串 | 是 | 一条陈述式编辑指令 |
| 字符串 | 是 | 单个源图片链接 |
| 枚举值 | 否 | 从支持的宽高比选项中选择 |
| 整数 | 否 | 用于生成结果可复现 |
仅支持单张图片——不支持数组。多图片流程请使用路径1(Nano Banana Edit)。
Invoke
调用示例
bash
runcomfy run blackforestlabs/flux-1-kontext/pro/edit \
--input '{
"prompt": "Keep the person'\''s face, pose, and clothing unchanged. Add an orange umbrella in her left hand and a slight smile.",
"image": "https://.../portrait.jpg"
}' \
--output-dir <absolute/path>bash
runcomfy run blackforestlabs/flux-1-kontext/pro/edit \
--input '{
"prompt": "保持人物的面部、姿势和服装不变。在她的左手添加一把橙色雨伞,并让她面带微笑。",
"image": "https://.../portrait.jpg"
}' \
--output-dir <absolute/path>Prompting tips
提示技巧
- One declarative instruction. "She is now holding an orange umbrella and smiling" — imperative, single change.
- Preservation first. Lead with then state the change.
"Keep [unchanged elements]" - Iterate small. Compound edits drift on a single pass; split into sequential passes.
- 使用单条陈述式指令:“她现在手持一把橙色雨伞并面带微笑”——简洁的祈使句,单一修改需求
- 先提保留需求:以开头,再说明修改内容
"保持[不变元素]" - 分步修改:单次复杂编辑容易出现偏差;拆分为多次连续操作
Route 4: Z-Image Turbo Inpaint — mask-driven precise region edit
路径4:Z-Image Turbo Inpaint — 基于蒙版的精准区域编辑
Model:
tongyi-mai/z-image/turbo/inpainting模型:
tongyi-mai/z-image/turbo/inpaintingSchema
参数 schema
| Field | Type | Required | Notes |
|---|---|---|---|
| string | yes | What to fill / replace; preservation constraints for the unmasked surround. |
| string | yes | Source image URL. |
| string | yes | Grayscale mask URL (white = inpaint, black = preserve). |
| float | no | 0.3–0.6 retouching, 0.7–1.0 full replacement. |
| float | no | 0.6–0.9 typical. |
| enum | no | W:H output ratio. |
| int | no | Reproducibility. |
| 字段 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| 字符串 | 是 | 填充/替换内容;需说明蒙版外区域的保留约束 |
| 字符串 | 是 | 源图片链接 |
| 字符串 | 是 | 灰度蒙版链接(白色=需要修复的区域,黑色=需要保留的区域) |
| 浮点数 | 否 | 0.3–0.6用于润色,0.7–1.0用于完全替换 |
| 浮点数 | 否 | 通常设置为0.6–0.9 |
| 枚举值 | 否 | 输出图片的宽高比 |
| 整数 | 否 | 用于生成结果可复现 |
Invoke
调用示例
Object removal (low strength):
bash
runcomfy run tongyi-mai/z-image/turbo/inpainting \
--input '{
"prompt": "Remove overhead cables; preserve rooflines and sky gradient; thin clean sky.",
"image": "https://.../street.jpg",
"mask_image": "https://.../cables-mask.png",
"strength": 0.5,
"control_scale": 0.8
}' \
--output-dir <absolute/path>Region replacement (high strength):
bash
runcomfy run tongyi-mai/z-image/turbo/inpainting \
--input '{
"prompt": "Replace busy backdrop with smooth light gray studio paper; mask background only.",
"image": "https://.../product.jpg",
"mask_image": "https://.../bg-mask.png",
"strength": 0.9
}' \
--output-dir <absolute/path>物体移除(低强度):
bash
runcomfy run tongyi-mai/z-image/turbo/inpainting \
--input '{
"prompt": "移除架空线缆;保留屋顶轮廓和天空渐变;生成干净的浅色天空。",
"image": "https://.../street.jpg",
"mask_image": "https://.../cables-mask.png",
"strength": 0.5,
"control_scale": 0.8
}' \
--output-dir <absolute/path>区域替换(高强度):
bash
runcomfy run tongyi-mai/z-image/turbo/inpainting \
--input '{
"prompt": "将杂乱背景替换为光滑的浅灰色摄影棚背景纸;仅蒙版背景区域。",
"image": "https://.../product.jpg",
"mask_image": "https://.../bg-mask.png",
"strength": 0.9
}' \
--output-dir <absolute/path>Prompting tips
提示技巧
- A mask URL is required — grayscale, white = inpaint region, black = preserve. Slight blur on mask edges (1–3px) blends better than sharp binary.
- Strength by intent: for retouching / cleanup,
0.3–0.5for object replacement with style match,0.6–0.7for full-region replacement.0.8–1.0 - Name what stays outside the mask in the prompt: ,
"preserve rooflines and sky gradient"."match brick pattern and mortar tone" - Spatial labels still help even though the mask defines the region: ,
"the left shelf"."upper-right quadrant"
- 必须提供蒙版链接——灰度图,白色=修复区域,黑色=保留区域。蒙版边缘轻微模糊(1-3像素)比尖锐的黑白边界融合效果更好
- 根据意图设置强度:用于润色/清理,
0.3–0.5用于风格匹配的物体替换,0.6–0.7用于全区域替换0.8–1.0 - 在提示中明确蒙版外保留内容:、
"保留屋顶轮廓和天空渐变""匹配砖块图案和砂浆色调" - 即使有蒙版,空间标签仍有帮助:、
"左侧架子""右上象限"
Limitations
局限性
- Each route inherits its model's limits. Nano Banana: 1–20 inputs, 1–4 outputs. GPT Image 2 Edit: up to 10 refs, 4 fixed sizes. Flux Kontext: single ref. Z-Image Inpaint: mask required.
- No multi-route blending. This skill picks one model per call.
- Brand-specific overrides — if the user named a specific model, route to the corresponding brand skill (,
gpt-image-edit,flux-kontext) for fuller treatment.nano-banana-edit
- 各路径继承对应模型的限制。Nano Banana:1-20张输入,1-4张输出。GPT Image 2 Edit:最多10个参考图,4种固定尺寸。Flux Kontext:仅支持单参考图。Z-Image Inpaint:必须使用蒙版。
- 不支持多路径混合。该技能每次调用仅选择一个模型。
- 品牌特定覆盖——如果用户指定了特定模型,请使用对应品牌的技能(、
gpt-image-edit、flux-kontext)以获得更完整的功能。nano-banana-edit
Exit codes
退出码
| code | meaning |
|---|---|
| 0 | success |
| 64 | bad CLI args |
| 65 | bad input JSON / schema mismatch |
| 69 | upstream 5xx |
| 75 | retryable: timeout / 429 |
| 77 | not signed in or token rejected |
Full reference: docs.runcomfy.com/cli/troubleshooting.
| 代码 | 含义 |
|---|---|
| 0 | 成功 |
| 64 | CLI参数错误 |
| 65 | 输入JSON错误/ schema不匹配 |
| 69 | 上游服务5xx错误 |
| 75 | 可重试:超时/429请求过多 |
| 77 | 未登录或令牌被拒绝 |
How it works
工作原理
The skill picks one of Nano Banana Edit / GPT Image 2 Edit / Flux Kontext Pro / Z-Image Turbo Inpaint based on user intent and invokes with the matching JSON body. The CLI POSTs to the Model API, polls the request, fetches the result, and downloads any / URL into . cancels the remote request before exit.
runcomfy run <model_id>.runcomfy.net.runcomfy.com--output-dirCtrl-C该技能会根据用户意图从Nano Banana Edit / GPT Image 2 Edit / Flux Kontext Pro / Z-Image Turbo Inpaint中选择一个模型,并调用命令及匹配的JSON参数。CLI会向Model API发送POST请求,轮询请求状态,获取结果,并将所有/链接的内容下载到指定的目录。按下会在退出前取消远程请求。
runcomfy run <model_id>.runcomfy.net.runcomfy.com--output-dirCtrl-CSecurity & Privacy
安全与隐私
- Token storage: writes the API token to
runcomfy loginwith mode 0600 (owner-only read/write). Set~/.config/runcomfy/token.jsonenv var to bypass the file entirely in CI / containers.RUNCOMFY_TOKEN - Input boundary: the user prompt is passed as a JSON string to the CLI via . The CLI does NOT shell-expand the prompt; it transmits the JSON body directly to the Model API over HTTPS. No shell injection surface from prompt content.
--input - Third-party content: image / mask / video URLs you pass are fetched by the RunComfy model server, not by the CLI on your machine. Treat external URLs as untrusted; image-based prompt injection is a known risk for any image-edit / video-edit model.
- Outbound endpoints: only (request submission) and
model-api.runcomfy.net/*.runcomfy.net(download whitelist for generated outputs). No telemetry, no callbacks.*.runcomfy.com - Generated-file size cap: the CLI aborts any single download > 2 GiB to prevent disk-fill from a malicious or runaway model output.
- 令牌存储:会将API令牌写入
runcomfy login,权限为0600(仅所有者可读写)。在CI/容器环境中可设置~/.config/runcomfy/token.json环境变量以绕过文件存储。RUNCOMFY_TOKEN - 输入边界:用户提示通过以JSON字符串形式传递给CLI。CLI不会对提示内容进行shell扩展;会直接通过HTTPS将JSON主体传输给Model API。提示内容不存在shell注入风险。
--input - 第三方内容:你传入的图片/蒙版/视频链接会由RunComfy模型服务器获取,而非本地CLI。请将外部链接视为不可信;图像提示注入是所有图像编辑/视频编辑模型的已知风险。
- 出站端点:仅允许访问(请求提交)和
model-api.runcomfy.net/*.runcomfy.net(生成结果下载白名单)。无遥测,无回调。*.runcomfy.com - 生成文件大小限制:CLI会中止任何超过2 GiB的单个文件下载,以防止恶意或异常模型输出占满磁盘。