Gemini Image Editor
Nano Banana inside ComfyUI, with up to four reference images
- image1
- image2
- image3
- image4
- image
- caption
- API Respond
- api_request
- api_response
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 likeimagen-3.0-generate-001andgemini-2.5-flashare 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.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | β | |
| api_key | STRING | β | |
| model | STRING | models/gemini-2.0-flash-preview-image-generation | β |
| temperature | FLOAT | 1.000β2 | β |
| max_retries | INT | 31β5 | β |
| batch_size | INT | 11β8 | β |
| seedopt | INT | 666666660β66666666 | β |
| image1opt | IMAGE | β | |
| image2opt | IMAGE | β | |
| image3opt | IMAGE | β | |
| image4opt | IMAGE | β | |
| api_versionopt | COMBO | auto | 4 options: auto, v1, v1beta, v1alpha |
| aspect_ratioopt | COMBO | default | 11 options: default, 1:1, 2:3, 3:2, 3:4, 4:3, +5 |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | β |
| caption | STRING | β |
| API Respond | STRING | β |
| api_request | STRING | β |
| api_response | STRING | β |