Nodes/ComfyUI-NanoBanana2/NanoBanana - Outpaint
ComfyUI Node

NanoBanana - Outpaint

Extend the canvas outward without breaking the illusion

By IxMxAMAR·Created 6 months ago·Updated about a month ago· 4
NanoBanana - Outpaint
  • image
  • network
  • image
api_key
modelgemini-3.1-flash-image-preview
custom_model
directionright
prompt
system_instruction
aspect_ratioAUTO

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.

CategoryNanoBanana2/Image

Inputs (9)

NameTypeDefaultDescription
api_keySTRINGNanoBanana - API key. Leave blank to use GEMINI_API_KEY env var.
modelCOMBOgemini-3.1-flash-image-previewImage-capable Gemini model for outpainting.
custom_modelSTRINGOverride with a custom model ID.
imageIMAGEThe source image to extend.
directionCOMBOrightDirection to extend the image.
promptSTRINGDescribe what should appear in the extended area.
system_instructionoptSTRINGSystem instruction for the outpainting model.
aspect_ratiooptCOMBOAUTOTarget aspect ratio after outpainting.
networkoptNB_NETWORKOptional. Wire a NanoBanana - Network Route node here to route this request through that proxy (e.g. US egress).

Outputs (1)

NameTypeDescription
imageIMAGE