Nodes/ComfyUI_NanaBanana2/🍌 NB2 Image Edit (keep/change)
ComfyUI Node

🍌 NB2 Image Edit (keep/change)

Nano Banana 2 image editing in ComfyUI

By tonykatarapro-web·Created 6 months ago·Updated 6 months ago· 3
🍌 NB2 Image Edit (keep/change)
  • image
  • image
◄promptKeep the character / change the background to a beach at sunsetâ–ș
◄project_idâ–ș
◄locationus-central1â–ș
◄modelgemini-3.1-flash-image-previewâ–ș
◄aspect_ratio1:1â–ș
◄access_tokenâ–ș
◄seed-1â–ș
◄use_search_groundingfalseâ–ș

Want to move a character out of her studio portrait and into a neon cyberpunk street without rebuilding the character? This is the node for that. NanaBanana2ImageEdit sends an image you already have up to Google's Nano Banana 2 (Gemini 3.1 Flash Image) with an edit instruction, and gets back the edited version. No masks, no inpainting model, no ControlNet - just a sentence about what to keep and what to change.

That "no masks" part is the real draw. Local inpainting chains make you paint a mask, pick a denoise strength, and pray the seams don't show. Gemini-style editing instead treats your instruction as the edit: you describe the change, it rebuilds the image. For swapping a background while holding onto a subject - the pack's whole "keep/change" framing - it's often faster than any local pipeline you'll assemble.

How it works

The mechanism is nearly identical to the pack's text-to-image node, with one extra step: the input image is converted from a ComfyUI IMAGE tensor to a base64-encoded PNG, then sent to the Vertex AI generateContent endpoint as an inlineData part alongside your prompt text. The model reads both and returns an edited image, which gets decoded back into a tensor. Your GPU does none of the work - the whole thing is a cloud call that costs real money per image.

The one input that matters: prompt

The default prompt is the whole trick in miniature:

Keep the character / change the background to a beach at sunset

The / isn't syntax - it's just how the author demonstrates the format, and it's a genuinely good habit. Say what to keep and what to change in the same sentence. "Keep the character and lighting, change the background to a neon cyberpunk street." The more explicitly you name what stays, the less the model will drift on it. This is the node where prompt wording actually earns you results.

The other required inputs are the pack-wide ones: image (the IMAGE you're editing), project_id, location, model, and aspect_ratio. Optional: access_token, seed (-1 = random), and use_search_grounding. Output is a single image tensor, ready for Save Image or any downstream node.

One gotcha worth internalizing: aspect_ratio applies to the output canvas on every call. Edit a 4:3 image while leaving the default at 1:1 and you'll get a 1:1 result, not your original framing. Set it to match your input before you run.

Installing and the shared pack gotchas

Same install as the whole pack - one line:

cd ComfyUI/custom_nodes
git clone https://github.com/tonykatarapro-web/ComfyUI_NanaBanana2

Then restart ComfyUI (or install "ComfyUI_NanaBanana2" via ComfyUI Manager). No pip dependencies, no model downloads.

The shared pain points apply here exactly as they do to the other nodes in the pack: you need a Google Cloud project with Vertex AI enabled and billing on, and a Bearer token - either pasted into access_token, set as GOOGLE_CLOUD_ACCESS_TOKEN, or fetched automatically if gcloud is installed. The token expires after an hour, so if a node that worked yesterday 401s today, that's your answer:

export GOOGLE_CLOUD_ACCESS_TOKEN=$(gcloud auth print-access-token)

And the pack's README says location should be global for this model - if the default us-central1 errors with model-not-found, switch it.

Two reality checks before you lean on this in production. First, it's Google's model with Google's content filters; the pack doesn't expose Vertex's safetySettings, and those filters got stricter in January 2026. Second, every output carries an invisible SynthID watermark, and you're paying per edit - so it's a great tool for concepting and character work, not something you want hammering your whole batch queue. Use it where the quality gap matters, keep your local pipeline for volume.

CategoryNanaBanana2 / Vertex

Inputs (9)

NameTypeDefaultDescription
imageIMAGE—
promptSTRINGKeep the character / change the background to a beach at sunset—
project_idSTRING—
locationCOMBOus-central18 options: global, us-central1, us-east1, us-west1, europe-west1, europe-west4, +2
modelCOMBOgemini-3.1-flash-image-preview2 options: gemini-3.1-flash-image-preview, gemini-3-pro-image-preview
aspect_ratioCOMBO1:110 options: 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, +4
access_tokenoptSTRING—
seedoptINT-1-1–2147483647—
use_search_groundingoptBOOLEANfalse—

Outputs (1)

NameTypeDescription
imageIMAGE—