Nodes/ComfyUI Gemini Nodes/Gemini Image Editor
ComfyUI Node

Gemini Image Editor

Nano Banana inside ComfyUI, with up to four reference images

By jqy-yoΒ·Created about a year agoΒ·Updated 11 months agoΒ· 7
Gemini Image Editor
  • image1
  • image2
  • image3
  • image4
  • image
  • caption
  • API Respond
  • api_request
  • api_response
β—„promptβ€”β–Ί
β—„api_keyβ–Ί
β—„modelmodels/gemini-2.0-flash-preview-image-generationβ–Ί
β—„temperature1.00β–Ί
β—„max_retries3β–Ί
β—„batch_size1β–Ί
β—„seed66666666β–Ί
β—„api_versionautoβ–Ί
β—„aspect_ratiodefaultβ–Ί

The Gemini image node you'll actually use

Google's Gemini image generation - the "Nano Banana" stack, as the community and the KB both call it - is some of the best text-rendering, edit-following image work available, and it's an API, not a local model. GeminiImageEditor is the pack's direct line into it. Give it a prompt, optionally up to four reference images, and it returns generated images as a standard ComfyUI IMAGE tensor you can pipe straight into your normal post-processing, upscaling, or saving nodes.

Where this shines versus local SD/Flux generation: edits that actually follow instructions. "Turn this photo into a watercolor" or "put the product on a white background" is exactly the Gemini sweet spot, and you get it without renting a GPU.

How it works

It calls the Gemini API's image-generation endpoint via google-genai, running batches asynchronously with retry logic and exponential backoff. Under the hood it pads input images to a minimum 1024x1024 with white borders before sending them (so small references don't get mangled), and if the API fails it returns a black placeholder image with the error text drawn on it rather than silently dying - you'll see exactly what went wrong instead of an empty wire.

The inputs that matter

  • prompt - the whole game. Gemini follows detailed, specific prompts better than diffusion models, so say what you want changed.
  • model - default is models/gemini-2.0-flash-preview-image-generation. Alternatives like imagen-3.0-generate-001 and gemini-2.5-flash are valid; you can type any model name.
  • image1–image4 - optional reference images. One for style, one for content, etc. This is the feature that separates the node from a plain text-to-image call.
  • batch_size - 1 to 8 images per run. The README's advice holds: use it for variations, don't blow your API budget testing.
  • temperature - 0.0–2.0, default 1.0. Lower (0.5–0.8) for consistency with a reference, higher (1.2–1.5) for variation.
  • seed - reproducibility when you need it.
  • aspect_ratio - added in a 2025 update: default, 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9. Pick before you prompt; you can't crop your way out of the wrong frame.

Outputs: image (the batch, feed it to a Save Image or Preview node), caption (the model's description of what it made), API Respond, plus api_request and api_response debug dumps.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/jqy-yo/comfyui-gemini-nodes
cd comfyui-gemini-nodes
pip install -r requirements.txt

Or ComfyUI Manager β†’ "ComfyUI Gemini Nodes". Restart. You need a Gemini API key in the api_key field or the GOOGLE_API_KEY env var - image generation is billed per image, so watch usage.

Where people get burned

Two things trip people up. First, model access: some image models are gated or region-locked, so "500 Internal Server Error" usually means your key lacks access or your region isn't supported - check Google AI Studio, and try imagen-3.0-generate-001 as a fallback. Second, the heavy censorship: Gemini image models refuse a lot (the KB notes ImageFX's "massive hidden biasing"), so a prompt that sails through local SD may come back blocked. And every image carries an invisible SynthID watermark - fine for most use, but worth knowing it's there. Use the error placeholder image to see what happened rather than wondering why the wire is empty.

CategoryπŸ€– Gemini

Inputs (13)

NameTypeDefaultDescription
promptSTRINGβ€”
api_keySTRINGβ€”
modelSTRINGmodels/gemini-2.0-flash-preview-image-generationβ€”
temperatureFLOAT1.000–2β€”
max_retriesINT31–5β€”
batch_sizeINT11–8β€”
seedoptINT666666660–66666666β€”
image1optIMAGEβ€”
image2optIMAGEβ€”
image3optIMAGEβ€”
image4optIMAGEβ€”
api_versionoptCOMBOauto4 options: auto, v1, v1beta, v1alpha
aspect_ratiooptCOMBOdefault11 options: default, 1:1, 2:3, 3:2, 3:4, 4:3, +5

Outputs (5)

NameTypeDescription
imageIMAGEβ€”
captionSTRINGβ€”
API RespondSTRINGβ€”
api_requestSTRINGβ€”
api_responseSTRINGβ€”