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模型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

端点与输入数据结构

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": "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
"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变体支持种子锁定+多
number_of_images
设置
品牌资产本地化调整保留构图,仅替换文本/调色板

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

退出码

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错误/数据结构不匹配
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.
该技能通过符合数据结构的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扩展,而是直接将JSON体通过HTTPS传输给模型API。提示词内容不存在shell注入风险。
  • 第三方内容:你传入的图片/遮罩/视频链接由RunComfy模型服务器获取,而非本地CLI。将外部链接视为不可信;基于图片的提示注入是所有图像/视频编辑模型的已知风险。
  • 出站端点:仅与
    model-api.runcomfy.net
    (请求提交)和
    *.runcomfy.net
    /
    *.runcomfy.com
    (生成结果下载白名单)通信。无遥测,无回调。
  • 生成文件大小限制:CLI会终止任何超过2 GiB的单个下载,防止恶意或异常模型输出占满磁盘。