nano-banana-edit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese🍌 Nano Banana Edit — Pro Pack on RunComfy
🍌 Nano Banana Edit — RunComfy专业套件
Google Nano Banana 2 Edit — the image-to-image edit endpoint of the Gemini-family flash-tier image model — hosted on the RunComfy Model API. Up to 20 input images per call for batch edits and multi-reference variation.
bash
npx skills add agentspace-so/runcomfy-skills --skill nano-banana-edit -gGoogle Nano Banana 2 Edit 是Gemini系列闪存级图像模型的图生图编辑端点,托管在RunComfy Model API上。每次调用最多支持20张输入图片,可用于批量编辑和多参考变体生成。
bash
npx skills add agentspace-so/runcomfy-skills --skill nano-banana-edit -gWhen to pick this model (vs siblings)
何时选择该模型(对比同类模型)
| You want | Use |
|---|---|
| Preserve subject identity, swap background or clothing | Nano Banana Edit ✓ |
| Edit up to 20 images consistently in one batch | Nano Banana Edit ✓ |
| Localize edit to "X only" with spatial language | Nano Banana Edit ✓ |
| Edit multilingual text inside the image (signs, labels) | GPT Image 2 edit |
| Single ref + precise local edit ("she's now holding X") | Flux Kontext |
| Generate a new image from scratch | Nano Banana 2 t2i (sibling skill) |
If the user said "nano banana edit" / "edit with nano banana" explicitly, route here regardless.
| 你的需求 | 使用模型 |
|---|---|
| 保留主体身份、替换背景或服装 | Nano Banana Edit ✓ |
| 一次批量处理最多20张图片,保持编辑一致性 | Nano Banana Edit ✓ |
| 使用空间语言定位编辑区域(如“仅修改X区域”) | Nano Banana Edit ✓ |
| 编辑图片中的多语言文本(标识、标签等) | GPT Image 2 edit |
| 单参考图+精准局部编辑(如“让她手持X物品”) | Flux Kontext |
| 从零生成新图片 | Nano Banana 2 t2i(同类技能) |
如果用户明确提到“nano banana edit” / “edit with nano banana”,无论需求如何都路由到该模型。
Prerequisites
前置条件
- RunComfy CLI —
npm i -g @runcomfy/cli - RunComfy account — opens a browser device-code flow.
runcomfy login - CI / containers — set instead of
RUNCOMFY_TOKEN=<token>.runcomfy login
- RunComfy CLI —
npm i -g @runcomfy/cli - RunComfy账号 — 执行会打开浏览器设备码登录流程。
runcomfy login - CI/容器环境 — 设置环境变量替代
RUNCOMFY_TOKEN=<token>。runcomfy login
Endpoints + input schema
端点与输入schema
google/nano-banana-2/edit
google/nano-banana-2/editgoogle/nano-banana-2/edit
google/nano-banana-2/edit| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
| string | yes | — | Edit instruction. Lead with preservation, end with the change. |
| array | yes | — | 1–20 publicly-fetchable HTTPS URLs. |
| int | no | 1 | 1–4 outputs per call. |
| int | no | — | Reproducibility. |
| enum | no | | |
| enum | no | | |
| enum | no | | |
| int | no | 4 | 1 (strict) – 6 (permissive). |
| bool | no | — | If true, restricts each round to one output. |
| bool | no | false | Web grounding (extra cost / latency). |
| 字段 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| string | 是 | — | 编辑指令。先说明需保留的内容,最后说明修改内容。 |
| array | 是 | — | 1–20个可公开访问的HTTPS URL。 |
| int | 否 | 1 | 每次调用生成1–4张输出图。 |
| int | 否 | — | 用于生成结果的可重复性。 |
| enum | 否 | | |
| enum | 否 | | |
| enum | 否 | | |
| int | 否 | 4 | 1(严格)– 6(宽松)。 |
| bool | 否 | — | 如果为true,每轮仅生成一张输出图。 |
| bool | 否 | false | 网络 grounding(额外成本/延迟)。 |
How to invoke
调用方式
Single-image background swap, identity preserved:
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 edit with locked framing:
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>Targeted spatial edit ("left object only"):
bash
runcomfy run google/nano-banana-2/edit \
--input '{
"prompt": "Remove the leftmost object only. Keep the right two objects, the table, and the lighting unchanged.",
"image_urls": ["https://.../still-life.jpg"]
}' \
--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>目标性空间编辑(“仅修改左侧物体”):
bash
runcomfy run google/nano-banana-2/edit \
--input '{
"prompt": "仅移除最左侧的物体。保留右侧两个物体、桌子和光线不变。",
"image_urls": ["https://.../still-life.jpg"]
}' \
--output-dir <absolute/path>Prompting — what actually works
提示词技巧——有效方法
Preservation first, change last. Always lead with Then state the change in one clean sentence. Models honor what's stated up front; tail-end preservations get ignored.
"Keep [identity / pose / clothing / brand / framing] unchanged."Localize with spatial language. "background only", "the left object", "the upper-right corner", "above the headline" — concrete spatial scopes are honored. "make it more X" is vague and drifts.
Batch consistency — when editing a series, lock and . Use the same prompt grammar across the batch so each output reads as a sibling, not a remix.
aspect_ratioresolutionIterate small. If a one-pass edit drifts, split into two: pass 1 changes background only, pass 2 swaps the subject's outfit. Cleaner edits, same total cost (assuming similar resolution).
Multi-image variation — pass up to 20 inputs to get a coherent batch. Useful for SKU galleries, A/B testing, character sheet variations.
Anti-patterns:
- Long compound instructions ("change A and B and C and D") — drift increases per added scope.
- Edit instructions written in passive voice ("the background should be changed") — be imperative.
- Missing preservation goals — model will subtly rewrite the face / brand.
- Aspect ratios that don't match input — causes crops or stretches.
先说明保留内容,最后说明修改内容。始终以开头,然后用简洁的句子说明修改内容。模型会优先遵循开头的保留要求;末尾的保留要求容易被忽略。
"保留[身份/姿势/服装/品牌/画幅]不变。"使用空间语言定位编辑区域。“仅修改背景”、“左侧物体”、“右上角”、“标题上方”——具体的空间范围会被模型识别。“让它更X”这类模糊描述会导致结果偏离。
批量编辑一致性——编辑系列图片时,锁定和。整个批量使用相同的提示词格式,确保每张输出图风格统一,而非杂乱的变体。
aspect_ratioresolution分步小幅度修改。如果单次编辑结果偏离预期,拆分为两次:第一次仅修改背景,第二次替换主体服装。编辑效果更清晰,总成本相同(假设分辨率相近)。
多图变体生成——最多传入20张输入图,生成连贯的批量结果。适用于SKU图库、A/B测试、角色表变体等场景。
反模式:
- 冗长的复合指令(“修改A、B、C和D”)——每增加一个修改范围,结果偏离的概率就会上升。
- 使用被动语态的编辑指令(“背景应该被修改”)——使用祈使句。
- 未说明保留目标——模型会细微修改面部/品牌。
- 与输入图不匹配的宽高比——会导致裁剪或拉伸。
Where it shines
适用场景
| Use case | Why Nano Banana Edit |
|---|---|
| SKU gallery — same product on different backgrounds | Batch of 20, identity-preserved, framing locked |
| Influencer / spokesperson background swaps | Strong identity preservation across edits |
| Localized object removal / addition | Spatial language honored |
| A/B variants for ad creative | Seed lock + multiple |
| Brand-asset relocalization | Same composition with text / palette swap |
| 使用场景 | 选择Nano Banana Edit的原因 |
|---|---|
| SKU图库——同一款产品搭配不同背景 | 支持20张批量处理、保留主体身份、锁定画幅 |
| 网红/代言人背景替换 | 多次编辑中仍能很好地保留主体身份 |
| 局部物体移除/添加 | 能识别空间语言定位编辑区域 |
| 广告创意A/B变体 | 支持种子锁定+多张 |
| 品牌资产本地化调整 | 保持构图不变,仅替换文本/配色 |
Sample prompts (verified to produce strong results)
示例提示词(已验证可生成优质结果)
Background swap (page example):
Keep the subject identity unchanged. Convert the background into a rainy
neon cyberpunk street.Targeted text replacement:
Keep the bottle, label, and lighting exactly as in the input.
Replace only the brand text on the label from "ALPHA" to "AURA",
same font weight, centered, white on black.Multi-image batch consistency:
For each input image: keep the subject's pose and identity unchanged.
Convert the background to a soft warm-grey studio sweep with subtle
floor shadow. Center the subject at the same fraction of frame as the
input.背景替换(页面示例):
保留主体身份不变。将背景转换为下雨的
霓虹赛博朋克街道。目标性文本替换:
完全保留瓶子、标签和光线不变。
仅将标签上的品牌文本从"ALPHA"替换为"AURA",
保持相同字体粗细、居中对齐、黑底白字。多图批量编辑一致性:
针对每张输入图:保留主体姿势和身份不变。
将背景转换为柔和的暖灰色工作室背景,带有轻微的
地面阴影。主体在画面中的位置比例与输入图一致。Limitations
局限性
- 1–20 input images per call — the first is treated as primary; the rest provide auxiliary cues.
- 1–4 outputs per call.
- Long compound prompts drift — split into multiple passes.
- Web search adds latency + cost — only enable on demand.
- For multilingual in-image text edits, GPT Image 2 edit wins.
- 每次调用支持1–20张输入图——第一张图作为主参考,其余图提供辅助线索。
- 每次调用生成1–4张输出图。
- 冗长的复合提示词会导致结果偏离——拆分为多次处理。
- 启用网络搜索会增加延迟和成本——仅按需启用。
- 编辑图片中的多语言文本,GPT Image 2 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 invokes with a JSON body matching the schema. The CLI POSTs to , polls the request, fetches the result, and downloads any / URL into . cancels the remote request before exit.
runcomfy run google/nano-banana-2/edithttps://model-api.runcomfy.net/v1/models/google/nano-banana-2/edit.runcomfy.net.runcomfy.com--output-dirCtrl-C该技能调用并传入符合schema的JSON参数。CLI向发送POST请求,轮询请求状态,获取结果,并将所有/链接的文件下载到目录。按会在退出前取消远程请求。
runcomfy run google/nano-banana-2/edithttps://model-api.runcomfy.net/v1/models/google/nano-banana-2/edit.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 - 第三方内容:你传入的图片/蒙版/视频URL由RunComfy模型服务器获取,而非本地CLI。请将外部URL视为不可信;基于图片的提示注入是所有图像/视频编辑模型的已知风险。
- 出站端点:仅与(请求提交)和
model-api.runcomfy.net/*.runcomfy.net(生成结果下载白名单)通信。无遥测、无回调。*.runcomfy.com - 生成文件大小限制:CLI会终止任何超过2 GiB的单个下载,防止恶意或异常模型输出占满磁盘。