Google Gemini - Image Editing
Gemini Image Editing
- image1
- image2
- image3
- image4
- edited_image
- result
- response_info
Google Gemini - Image Editing is the node that does what local diffusion models are genuinely bad at: editing an existing image from natural-language instructions. "Remove the watermark," "turn the day scene into dusk," "keep the pose, change the outfit." You feed it up to four images plus an instruction, and Gemini - the same Nano Banana family as the generation node - hands back the edited image as a normal IMAGE tensor. In one sitting you can chain edits the way you'd describe them to a human retoucher, not the way you'd fight a ControlNet.
How it works
Like the pack's other nodes it's a REST client, not a model runner. It converts each input image to base64 PNG, appends your edit_prompt as a text part, and posts a generateContent request asking for both text and image output. Then it extracts the image part back into a tensor and the text part into a result string. One hard rule baked into the code: it refuses to run with zero input images - you get Error: No input images provided back, so always wire at least one image in.
That multi-image input is where the interesting workflows live. Four reference images is enough for fusion-style edits and character-consistency work - keep the same person across scenes by feeding the model your reference and telling it what to change. The Pro model accepts the most references and reasons about the edit before generating.
Inputs that matter
- edit_prompt (required, multiline) - the instruction. The more concrete, the better: "change the background to a rainy street" beats "make it moodier."
- image1–image4 - the source images. First one is your primary; the rest are references.
- model - same three-option dropdown as generation:
gemini-2.5-flash-image(default),gemini-3-pro-image-preview(Pro),gemini-3.1-flash-image-preview. - aspect_ratio and image_size - set the output framing; like the generation node,
image_sizeonly takes effect on the Pro models. - seed - reproducibility; only sent when above 0.
- api_key / base_url - runtime overrides; leave empty if you set the key once in the Config Manager.
Three outputs: edited_image (the result, wire it to Preview/Save), result (Gemini's text, often a summary of what it changed), and response_info (a JSON string with model, settings, input_image_count, and status - your failure diagnostics when something goes wrong).
Install
cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/DannyTuu/Comfyui_gemini_node.git
python -m pip install -U requests pillow numpy
Restart ComfyUI, or search Comfyui_gemini_node in ComfyUI Manager. No model downloads - you only need a Gemini API key, or a relay base_url if you're routing through a reseller for cheaper per-image pricing.
Where people get burned
- Every edit is a paid call, and edits chain. "I'll just iterate" turns into ten metered calls in ten minutes. The community's cost complaints about API nodes are exactly this - it adds up far faster than you expect.
- The filter is Google's, not yours. Famous-IP, celebrity, and anything tripping IMAGE_SAFETY gets refused or silently sanitized, and every output carries the invisible SynthID watermark. If the thing you're editing violates Google's policy, no
base_urloverride fixes that - a reseller still passes your prompt to Google's model. - Read
resultandresponse_infowhenedited_imagecomes back empty. Errors return as text, not exceptions. When the image socket isNone, the answer to "why" is sitting in those two strings. - Input resolution matters. The node sends whatever you feed it as PNG; feed it a tiny image and don't be surprised the edit comes back soft. Upscale the source first if you care about output detail.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| edit_prompt | STRING | — | |
| model | COMBO | gemini-2.5-flash-image | 3 options: gemini-2.5-flash-image, gemini-3-pro-image-preview, gemini-3.1-flash-image-preview |
| image1opt | IMAGE | — | |
| image2opt | IMAGE | — | |
| image3opt | IMAGE | — | |
| image4opt | IMAGE | — | |
| api_keyopt | STRING | — | |
| base_urlopt | STRING | — | |
| temperatureopt | FLOAT | 1.00–2 | — |
| top_popt | FLOAT | 0.950–1 | — |
| max_tokensopt | INT | 81921–65536 | — |
| system_instructionopt | STRING | — | |
| aspect_ratioopt | COMBO | auto | 11 options: auto, 16:9, 4:3, 4:5, 3:2, 1:1, +5 |
| image_sizeopt | COMBO | auto | 4 options: auto, 1K, 2K, 4K |
| seedopt | INT | 00–2147483647 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| edited_image | IMAGE | — |
| result | STRING | — |
| response_info | STRING | — |