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 -g
Google Nano Banana 2 Edit — Gemini系列轻量图像模型的图像到图像编辑端点,托管于RunComfy Model API。每次调用支持最多20张输入图片,可实现批量编辑和多参考图变体生成。
bash
npx skills add agentspace-so/runcomfy-skills --skill nano-banana-edit -g

When to pick this model (vs siblings)

选择该模型的场景(对比同系列工具)

You wantUse
Preserve subject identity, swap background or clothingNano Banana Edit
Edit up to 20 images consistently in one batchNano Banana Edit
Localize edit to "X only" with spatial languageNano 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 scratchNano 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

前置条件

  1. RunComfy CLI
    npm i -g @runcomfy/cli
  2. RunComfy account
    runcomfy login
    opens a browser device-code flow.
  3. CI / containers — set
    RUNCOMFY_TOKEN=<token>
    instead of
    runcomfy login
    .
  1. RunComfy CLI — 执行
    npm i -g @runcomfy/cli
    安装
  2. RunComfy账号 — 执行
    runcomfy login
    会打开浏览器设备码登录流程
  3. CI/容器环境 — 设置环境变量
    RUNCOMFY_TOKEN=<token>
    替代
    runcomfy login
    操作

Endpoints + input schema

端点与输入schema

google/nano-banana-2/edit

google/nano-banana-2/edit

FieldTypeRequiredDefaultNotes
prompt
stringyesEdit instruction. Lead with preservation, end with the change.
image_urls
arrayyes1–20 publicly-fetchable HTTPS URLs.
number_of_images
intno11–4 outputs per call.
seed
intnoReproducibility.
aspect_ratio
enumno
auto
auto
(follows input) or fixed ratios — lock for batch consistency.
resolution
enumno
1K
0.5K
/
1K
/
2K
/
4K
.
output_format
enumno
png
png
/
jpeg
/
webp
.
safety_tolerance
intno41 (strict) – 6 (permissive).
limit_generations
boolnoIf true, restricts each round to one output.
enable_web_search
boolnofalseWeb grounding (extra cost / latency).
字段类型是否必填默认值说明
prompt
string编辑指令。先说明需保留的内容,再描述修改需求。
image_urls
array1–20个可公开访问的HTTPS图片链接。
number_of_images
int1每次调用生成1–4张输出图片。
seed
int用于生成结果的可复现性。
aspect_ratio
enum
auto
auto
(跟随输入图片比例)或固定比例——批量编辑时锁定可保证一致性。
resolution
enum
1K
0.5K
/
1K
/
2K
/
4K
output_format
enum
png
png
/
jpeg
/
webp
safety_tolerance
int41(严格)– 6(宽松)。
limit_generations
bool如果设为true,每轮仅生成一张输出图片。
enable_web_search
boolfalse基于网络信息生成(会增加成本和延迟)。

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
"Keep [identity / pose / clothing / brand / framing] unchanged."
Then state the change in one clean sentence. Models honor what's stated up front; tail-end preservations get ignored.
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
aspect_ratio
and
resolution
. Use the same prompt grammar across the batch so each output reads as a sibling, not a remix.
Iterate 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_ratio
resolution
。批量使用相同的提示词结构,确保每张输出图片风格统一,而非随机修改。
分步小幅度修改。如果单次编辑结果偏离预期,可拆分为两步:第一步仅修改背景,第二步替换主体服装。最终编辑效果更精准,总成本相近(假设分辨率相同)。
多图变体生成——最多传入20张输入图片,生成风格一致的批量结果。适用于SKU图库、A/B测试、角色设定图变体等场景。
避坑指南:
  • 冗长的复合指令(“修改A、B、C和D”)——每增加一个修改范围,结果偏离的概率就会上升。
  • 被动语态的编辑指令(“背景应该被修改”)——使用祈使句更有效。
  • 未明确保留目标——模型会轻微修改面部/品牌元素。
  • 与输入图片不匹配的宽高比——会导致裁剪或拉伸。

Where it shines

优势场景

Use caseWhy Nano Banana Edit
SKU gallery — same product on different backgroundsBatch of 20, identity-preserved, framing locked
Influencer / spokesperson background swapsStrong identity preservation across edits
Localized object removal / additionSpatial language honored
A/B variants for ad creativeSeed lock + multiple
number_of_images
Brand-asset relocalizationSame 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

退出码

codemeaning
0success
64bad CLI args
65bad input JSON / schema mismatch
69upstream 5xx
75retryable: timeout / 429
77not signed in or token rejected
代码含义
0成功
64CLI参数错误
65输入JSON错误/schema不匹配
69上游服务5xx错误
75可重试:超时/429限流
77未登录或令牌被拒绝

How it works

工作原理

The skill invokes
runcomfy run google/nano-banana-2/edit
with a JSON body matching the schema. The CLI POSTs to
https://model-api.runcomfy.net/v1/models/google/nano-banana-2/edit
, polls the request, fetches the result, and downloads any
.runcomfy.net
/
.runcomfy.com
URL into
--output-dir
.
Ctrl-C
cancels the remote request before exit.
本工具通过符合schema的JSON参数调用
runcomfy run google/nano-banana-2/edit
。CLI会向
https://model-api.runcomfy.net/v1/models/google/nano-banana-2/edit
发送POST请求,轮询请求状态,获取结果,并将
.runcomfy.net
/
.runcomfy.com
域名下的生成图片下载到
--output-dir
指定目录。按下
Ctrl-C
会在退出前取消远程请求。

Security & Privacy

安全与隐私

  • Token storage:
    runcomfy login
    writes the API token to
    ~/.config/runcomfy/token.json
    with mode 0600 (owner-only read/write). Set
    RUNCOMFY_TOKEN
    env var to bypass the file entirely in CI / containers.
  • Input boundary: the user prompt is passed as a JSON string to the CLI via
    --input
    . 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.
  • 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
    model-api.runcomfy.net
    (request submission) and
    *.runcomfy.net
    /
    *.runcomfy.com
    (download whitelist for generated outputs). No telemetry, no callbacks.
  • Generated-file size cap: the CLI aborts any single download > 2 GiB to prevent disk-fill from a malicious or runaway model output.
  • 令牌存储
    runcomfy login
    会将API令牌写入
    ~/.config/runcomfy/token.json
    ,权限为0600(仅所有者可读写)。在CI/容器环境中可设置
    RUNCOMFY_TOKEN
    环境变量,跳过文件存储。
  • 输入边界:用户提示词通过
    --input
    以JSON字符串形式传递给CLI。CLI不会对提示词进行shell扩展,而是直接通过HTTPS将JSON主体传输给Model API。提示词内容不存在shell注入风险。
  • 第三方内容:你传入的图片/蒙版/视频链接由RunComfy模型服务器获取,而非本地CLI。请将外部链接视为不可信内容;基于图像的提示注入是所有图像/视频编辑模型的已知风险。
  • 出站端点:仅与
    model-api.runcomfy.net
    (请求提交)和
    *.runcomfy.net
    /
    *.runcomfy.com
    (生成结果下载白名单)通信。无遥测数据,无回调操作。
  • 生成文件大小限制:CLI会终止任何超过2 GiB的单个文件下载,防止恶意或异常模型输出占满磁盘空间。