NanoBanana - Outpaint
Extend the canvas outward without breaking the illusion
- image
- network
- image
Outpainting is inpainting's big sibling: instead of filling a hole inside the image, you extend the image outward and invent what's beyond the frame. Portrait to landscape, crop a subject and build out the environment around it, turn a tight shot into a wide one. This node does that with Gemini - pick a direction, describe what should be out there, and it hallucinates a plausible continuation that matches the original's style and lighting.
The main advantage over doing it manually is seamlessness. Local outpainting means padding the canvas, cropping, and re-sampling with the right denoise so the new area blends - a fiddly multi-node dance. Here you type a sentence and get a finished image back. You'll still want a local upscaler after it if you're pushing resolution, but the hard part is done.
How it works
The node sends your source image (encoded as JPEG at 95 quality) to a Gemini image model along with a constructed instruction: "Extend this image to the {direction}. Fill the new area with: {your prompt}." The model regenerates the whole canvas with the extension baked in, and returns it as a standard IMAGE tensor.
Inputs:
- image - the source to extend.
- direction - right, left, up, down, or all. Defaults to right. "all" expands in every direction at once.
- prompt - what should appear in the extended area. Be descriptive; the model needs to know what's beyond the frame.
- aspect_ratio - target aspect ratio after outpainting (AUTO = let the model decide).
- system_instruction - optional; defaults to a "seamless extender" prompt if empty.
Output: image.
Installation
Part of the NanoBanana2 pack - install it once and this node comes along:
cd ComfyUI/custom_nodes
git clone https://github.com/IxMxAMAR/ComfyUI-NanoBanana2
pip install google-genai
ComfyUI Manager: search NanoBanana2. Needs a Gemini API key from aistudio.google.com, or GEMINI_API_KEY env var.
Gotchas
The honest limits: the model can only extend so far before it runs out of canvas budget, so a gigantic expansion in one call may come back soft or repeat itself - for extreme extensions, do it in steps and use each result as the next source. And the new area is a plausible guess, not a reconstruction of your missing data; if the original has distinctive repeating elements (a tiled floor, a specific fabric pattern) Gemini will approximate rather than match exactly. That's fine for "what's beyond the frame" vibes and wrong for anything that needs the pattern to continue precisely. Same filters and pricing caveats as the rest of the pack apply - refusals are descriptive, and every call costs.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| api_key | STRING | NanoBanana - API key. Leave blank to use GEMINI_API_KEY env var. | |
| model | COMBO | gemini-3.1-flash-image-preview | Image-capable Gemini model for outpainting. |
| custom_model | STRING | Override with a custom model ID. | |
| image | IMAGE | The source image to extend. | |
| direction | COMBO | right | Direction to extend the image. |
| prompt | STRING | Describe what should appear in the extended area. | |
| system_instructionopt | STRING | System instruction for the outpainting model. | |
| aspect_ratioopt | COMBO | AUTO | Target aspect ratio after outpainting. |
| networkopt | NB_NETWORK | Optional. Wire a NanoBanana - Network Route node here to route this request through that proxy (e.g. US egress). |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |