ARC NanoB Gemini
ARC-focused Gemini / Nano Banana image generation and editing nodes for ComfyUI, derived from ComfyUI-NanoB-Edit-Gemini.
Nodes (3)
ARC NanoB Gemini for ComfyUI
An ARC-focused modified implementation of ComfyUI-NanoB-Edit-Gemini by comrender, for Google Gemini / Nano Banana native image generation and editing in ComfyUI.
This project is derived from
comrender/ComfyUI-NanoB-Edit-Geminiand retains the upstream MIT license and copyright notice. ARC-specific modifications include updated Gemini API behavior, reference handling, workflow-oriented controls, billing/debug tooling, and compositing-safematch_inputgeometry behavior.
Upstream project: https://github.com/comrender/ComfyUI-NanoB-Edit-Gemini
ARC-specific direction
This fork is maintained for ARC workflows while remaining usable as a normal ComfyUI custom node. The main node class IDs are intentionally retained for workflow compatibility.
ComfyUI custom node for Gemini native image generation/editing with multimodal image input support.
Supported Models
gemini-2.5-flash-image(Nano Banana)gemini-3-pro-image-preview(Nano Banana Pro)gemini-3.1-flash-image-preview(Nano Banana 2)
Main Features
- Multi-model image editing with prompt + up to 14 input reference images.
- Parallel request execution to generate multiple variations quickly.
- Model-aware validation for ratios, resolutions, and feature toggles.
- Google Search toggle for supported Gemini 3 image models.
- Thinking toggle for Gemini 3.1 Flash Image Preview.
- File API toggle for large or reusable input images.
- Output format control:
png,jpg,webp. - Debug payload mode with safe base64 truncation and request-size diagnostics.
- API key from node input or
GEMINI_API_KEYenvironment variable.
Node Inputs
Required
prompt(STRING, multiline)model:gemini-2.5-flash-imagegemini-3-pro-image-previewgemini-3.1-flash-image-preview
gemini_api_key(STRING, optional ifGEMINI_API_KEYenv var exists)seed(INT)aspect_ratio:- Common:
1:1,2:3,3:2,3:4,4:3,4:5,5:4,9:16,16:9,21:9 - Gemini 3.1 additions:
1:4,4:1,1:8,8:1
- Common:
resolution:0.5K,1K,2K,4K0.5Kmaps to Gemini API value512and is valid only forgemini-3.1-flash-image-previewgemini-2.5-flash-imageis constrained to1Kin this node
output_format:png,jpg,webpnum_images(1-4, parallel requests)use_file_api(BOOLEAN)use_google_search(BOOLEAN)enable_thinking(BOOLEAN)- Applies to
gemini-3.1-flash-image-previewonly
- Applies to
safety_filter:block_none,block_few,block_some,block_mostdebug_payload(BOOLEAN)
Optional image inputs
image1...image5(single image sockets)image6_14(batched IMAGE socket)
Model-Specific Behavior
-
gemini-3.1-flash-image-preview- Supports
0.5K,1K,2K,4K - Supports expanded aspect ratios (
1:4,4:1,1:8,8:1) - Thinking toggle maps to
thinkingConfig.thinkingLevel(HIGHvsMINIMAL) - Supports Google Search tool toggle
- Supports
-
gemini-3-pro-image-preview- Supports
1K,2K,4K - Supports base aspect-ratio set
- Supports Google Search tool toggle
- Supports
-
gemini-2.5-flash-image- Uses ratio-only image configuration in this node
- Resolution constrained to
1Kin this implementation - Google Search and Thinking toggle are not enabled for this model in this node
Multi-Image Reference Limits (Latest Guidance)
This node accepts up to 14 input references and truncates extra inputs with a warning.
Latest model guidance for up to 14 references:
gemini-3.1-flash-image-preview- Up to 10 object references with high-fidelity detail
- Up to 4 character-consistency references
gemini-3-pro-image-preview- Up to 6 object references with high-fidelity detail
- Up to 5 character-consistency references
The node cannot automatically classify "object" vs "character" images, so it enforces only the global 14-image cap and prints warnings when count exceeds per-model recommended ranges.
Image Understanding and Quality Notes
To improve quality and instruction following:
- Keep source images clear, correctly oriented, and not blurry.
- Prefer concise but explicit prompts with concrete edits.
- For multimodal prompts, this node sends image parts before text instruction for better image-understanding behavior.
- Keep inline payloads below API size limits.
Request Size and Error Handling
- API inline payloads are validated with a conservative preflight budget.
- If estimated inline size is too large and File API is off, the node fails early with a clear message suggesting enabling File API.
- When File API is on, images are uploaded first and the node sends
fileDatareferences instead of inline base64 image parts. - File API upload start/finalize failures are surfaced with explicit HTTP details.
- HTTP/network errors include per-request diagnostics.
- Candidate parsing failures include finish reason + snippet of text response when no image is returned.
- Safety blocks from
promptFeedbackare surfaced in logs.
Output Format Support
This node supports output normalization to:
image/pngimage/jpegimage/webp
HEIC and HEIF output are intentionally skipped in this version.
Security Best Practices
Use environment variables for API keys whenever possible.
Do not publish workflows that include your API key in node text fields.
Set GEMINI_API_KEY
Windows
- Open Edit the system environment variables.
- Open Environment Variables and add:
- Name:
GEMINI_API_KEY - Value:
your_actual_api_key_here
- Name:
- Restart ComfyUI after changes.
Linux/macOS
Add to shell profile:
export GEMINI_API_KEY="your_actual_api_key_here"
References
- Gemini image generation docs: https://ai.google.dev/gemini-api/docs/image-generation
- 14 reference images details: https://ai.google.dev/gemini-api/docs/image-generation#use-14-images
- Gemini image understanding docs: https://ai.google.dev/gemini-api/docs/image-understanding
2026-08 NanoB reference/API update
- Reference Stacker now accepts IMAGE inputs directly; no weighting is applied.
- Reference Weight/Influence is retained only as a legacy adapter for older workflows.
- Gemini 3.1 Flash Image and Gemini 3 Pro Image use the current stable model IDs.
- Requests use the Gemini Interactions API.
- Gemini 3.1 Flash Image Thinking Mode maps to the real
minimal/highAPI setting. - Reference behavior is intentionally simple: first image is the edit target; additional images are prompt-directed references.
match_inputuses a compositing-safe geometry path: the primary image is edge-padded without scaling/cropping to Gemini's nearest supported native output ratio, Gemini is called with the explicit ratio/resolution, then the returned image is uniformly scaled back to the padded canvas and only the temporary padding is removed. This restores the exact original W×H without anisotropic stretching.- The previous v1.0.4 hard resize path was removed because forcing unequal aspect ratios directly to the source W×H could shift geometry and break downstream masked compositing.
- Manual aspect-ratio modes continue to use Gemini preset aspect ratio + resolution output sizing.