nano-banana-edit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNano 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模型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
端点与输入数据结构
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图片链接。 |
| int | 否 | 1 | 每次调用生成1–4张输出图。 |
| int | 否 | — | 用于结果复现。 |
| enum | 否 | | |
| enum | 否 | | |
| enum | 否 | | |
| int | 否 | 4 | 1(严格)– 6(宽松)。 |
| bool | 否 | — | 如果设为true,每轮仅生成一张输出图。 |
| bool | 否 | false | 基于网络信息生成(额外成本/延迟)。 |
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": "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>锁定画幅的批量编辑:
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": "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>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.背景替换(页面示例):
Keep the subject identity unchanged. Convert the background into a rainy
neon cyberpunk street.目标化文本替换:
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.多图批量一致性:
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.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错误/数据结构不匹配 |
| 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该技能通过符合数据结构的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扩展,而是直接将JSON体通过HTTPS传输给模型API。提示词内容不存在shell注入风险。
--input - 第三方内容:你传入的图片/遮罩/视频链接由RunComfy模型服务器获取,而非本地CLI。将外部链接视为不可信;基于图片的提示注入是所有图像/视频编辑模型的已知风险。
- 出站端点:仅与(请求提交)和
model-api.runcomfy.net/*.runcomfy.net(生成结果下载白名单)通信。无遥测,无回调。*.runcomfy.com - 生成文件大小限制:CLI会终止任何超过2 GiB的单个下载,防止恶意或异常模型输出占满磁盘。