nano-banana-edit

nano-banana-edit

使用 RunComfy 上的 Google Nano Banana 2(圖像到圖像編輯端點)編輯圖片。說明 Nano Banana Edit 的優勢(保留主體身份、更換背景、使用空間語言進行局部編輯、最多 20 張圖片的批量編輯)、架構,以及何時改用 GPT Image 2 edit / Flux Kontext / Nano Banana 2 t2i。透過本機 RunComfy CLI 執行 `runcomfy run google/nano-banana-2/edit`。觸發關鍵字為 "nano banana edit"、"edit with nano banana"、"image edit nano banana" 或任何明確要求使用此模型編輯的指令。

2星標
2分支
更新於 2026/6/18
SKILL.md
readonlyread-only
name
nano-banana-edit
description

Edit images with Google Nano Banana 2 (image-to-image edit endpoint) on RunComfy. Documents Nano Banana Edit's strengths (preserve subject identity, swap background, localize edits with spatial language, multi-image batch edits up to 20 inputs), the schema, and when to route to GPT Image 2 edit / Flux Kontext / Nano Banana 2 t2i instead. Calls `runcomfy run google/nano-banana-2/edit` through the local RunComfy CLI. Triggers on "nano banana edit", "edit with nano banana", "image edit nano banana", or any explicit ask to edit with this model.

Nano Banana Edit — Pro Pack on RunComfy

runcomfy.com · Edit endpoint · GitHub

Google Nano Banana 2 Edit — 屬於 Gemini 系列快閃層級圖像模型的圖像到圖像編輯端點,託管於 RunComfy Model API。每次呼叫最多可處理 20 張輸入圖片,支援批量編輯與多參考變體。

npx skills add agentspace-so/runcomfy-skills --skill nano-banana-edit -g

何時選擇此模型(相較於同系列其他模型)

您想要 使用
保留主體身份、更換背景或服裝 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」,無論如何都導向此處。

前置需求

  1. RunComfy CLInpm i -g @runcomfy/cli
  2. RunComfy 帳號runcomfy login 會開啟瀏覽器裝置碼流程。
  3. CI / 容器環境 — 設定 RUNCOMFY_TOKEN=<token> 取代 runcomfy login

端點與輸入架構

google/nano-banana-2/edit

欄位 型別 必填 預設值 說明
prompt string 編輯指令。先描述保留部分,最後說明變更。
image_urls array 1–20 個可公開存取的 HTTPS URL。
number_of_images int 1 每次呼叫輸出 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 int 4 1(嚴格)– 6(寬鬆)。
limit_generations bool 若為 true,每輪僅限制一個輸出。
enable_web_search bool false 網路搜尋(額外成本 / 延遲)。

如何呼叫

單張圖片背景更換,保留身份:

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>

批量編輯,鎖定構圖:

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>

指定空間編輯(僅左側物體):

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>

提示技巧 — 實際有效的方法

先保留,後變更。 始終以 "Keep [identity / pose / clothing / brand / framing] unchanged." 開頭,然後用一句簡潔的句子說明變更。模型會優先處理開頭說明的內容;結尾才提到的保留目標會被忽略。

使用空間語言指定範圍。 「僅背景」、「左側物體」、「右上角」、「標題上方」— 具體的空間範圍會被遵守。「讓它更 X」這種模糊說法會導致偏移。

批量一致性 — 編輯一系列圖片時,鎖定 aspect_ratioresolution。在整個批次中使用相同的提示語法,讓每個輸出看起來像是同系列,而非重新混搭。

小步驟迭代。 如果一次編輯就偏移,分成兩次:第一次只改背景,第二次更換主體服裝。編輯更乾淨,總成本相同(假設解析度相近)。

多圖片變體 — 傳入最多 20 張輸入以獲得一致的批次。適用於 SKU 圖庫、A/B 測試、角色表變體。

反模式:

  • 冗長的複合指令(「改變 A 和 B 和 C 和 D」)— 每增加一個範圍,偏移風險就增加。
  • 被動語態的編輯指令(「背景應該被改變」)— 請使用祈使句。
  • 缺少保留目標 — 模型會微妙地改寫臉部 / 品牌。
  • 長寬比與輸入不符 — 導致裁切或拉伸。

擅長領域

使用案例 為什麼選擇 Nano Banana Edit
SKU 圖庫 — 同一產品不同背景 批量 20 張,保留身份,鎖定構圖
網紅 / 發言人背景更換 跨編輯的強身份保留
局部物體移除 / 添加 空間語言被遵守
廣告素材的 A/B 變體 鎖定種子 + 多個 number_of_images
品牌素材重新在地化 相同構圖,文字 / 色板更換

範例提示(經驗證效果良好)

背景更換(頁面範例):

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.

限制

  • 每次呼叫 1–20 張輸入圖片 — 第一張視為主體,其餘提供輔助線索。
  • 每次呼叫 1–4 張輸出。
  • 冗長的複合提示會偏移 — 請分成多次處理。
  • 網路搜尋增加延遲與成本 — 僅在需要時啟用。
  • 對於圖片內多語言文字編輯,GPT Image 2 edit 更佳。

結束代碼

代碼 意義
0 成功
64 CLI 參數錯誤
65 輸入 JSON 錯誤 / 架構不符
69 上游 5xx 錯誤
75 可重試:逾時 / 429
77 未登入或 token 被拒絕

完整參考: docs.runcomfy.com/cli/troubleshooting

運作方式

此技能使用符合架構的 JSON 主體呼叫 runcomfy run google/nano-banana-2/edit。CLI 將 POST 請求發送至 https://model-api.runcomfy.net/v1/models/google/nano-banana-2/edit,輪詢請求狀態,取得結果,並將任何 .runcomfy.net/.runcomfy.com URL 下載至 --output-dir。按下 Ctrl-C 可在結束前取消遠端請求。

安全性與隱私

  • Token 儲存runcomfy login 將 API token 寫入 ~/.config/runcomfy/token.json,權限設為 0600(僅擁有者可讀寫)。在 CI / 容器環境中,可設定 RUNCOMFY_TOKEN 環境變數以繞過檔案。
  • 輸入邊界:使用者提示透過 --input 以 JSON 字串傳遞給 CLI。CLI 不會對提示進行 shell 展開,而是直接將 JSON 主體透過 HTTPS 傳送至 Model API。提示內容不會造成 shell 注入風險。
  • 第三方內容:您傳遞的圖片 / 遮罩 / 影片 URL 由 RunComfy 模型伺服器擷取,而非您本機的 CLI。請將外部 URL 視為不受信任;基於圖片的提示注入是任何圖片編輯 / 影片編輯模型的已知風險。
  • 對外端點:僅 model-api.runcomfy.net(請求提交)和 *.runcomfy.net / *.runcomfy.com(生成輸出的下載白名單)。無遙測、無回呼。
  • 生成檔案大小上限:CLI 會中止任何超過 2 GiB 的單一下載,以防止惡意或失控模型輸出導致磁碟空間耗盡。