Gemini Prompt Builder (scene-conditioned)
Tell Gemini What Scene It's Actually Extending
- prompt
Gemini (a.k.a. Nano Banana) outpaints best when it knows what it's looking at. Feed it "a mountain lake at golden hour" and the borders fill with lake and ridge; leave it generic and you get plausible but random filler. Gemini Prompt Builder is the little node that makes the "knows what it's looking at" part happen: it folds a scene description into the exact outpainting prompt the pack's generate node wants.
It's a pure string builder. No API call, no model download, no settings to tune - which makes it the least dramatic node in this pack and still a genuinely useful one.
How it works
The pack's normal outpainting prompt tells Gemini that image 1 has solid colored borders to fill, image 2 is a mask (white = fill, black = keep), image 3 is the original for reference, and the scene should extend seamlessly. That's the plain prompt, and it's fine. Gemini Prompt Builder takes it and inserts one extra line: "For context, the scene is: {your description}" before the "seamlessly extend" instruction.
The interesting bit is what it deliberately does not do. The source is explicit: the injected wording is context, not a "preserve exactly / no visible box" instruction, because testing showed that kind of guarding makes the model protect the original as a hard rectangle and stamp the very box you're trying to avoid. So the design is "here's what the scene is" rather than "don't mess up the original."
It also fails open. If scene_context is empty or looks like an error string (starts with "Error:", "API Error", "Unexpected API response"), it falls back to the plain prompt instead of blocking. A dead describe node upstream never stops a job - you just get the generic prompt.
Inputs and output
One input, scene_context (STRING, marked forceInput - it's meant to be wired from another node, not typed). The obvious source is a vision / "describe this image" node - anything that turns your original image into a one-line scene description. The single prompt output is the assembled string, and it wires straight into GeminiImageGenerate's prompt input.
Install
Same shared install as every node in this pack:
# ComfyUI Manager → search "ComfyUI-Outpainting-Gemini", or:
cd ComfyUI/custom_nodes
git clone https://github.com/jzhang-POP/ComfyUI-Outpainting-Gemini
source ../venv/bin/activate && pip install scipy # pack-wide dependency, see below
Restart ComfyUI. The README's clone command is a YOUR_USERNAME/Vermeer-Gemini.git placeholder typo - use the URL above. One pack gotcha worth repeating: there's no requirements.txt, yet the pack imports scipy at load time, so if scipy isn't in your ComfyUI venv none of its nodes (this one included) will register.
Where it sits in the workflow
The typical chain: Gemini Pad Calculator pads your image and outputs the mask → a describe/vision node reads the scene → Gemini Prompt Builder turns that description into the prompt → Gemini Image Generate gets the padded image, the mask image, and this prompt → Gemini Composite stitches your original back. This node is the two wire connections in the middle that keep Gemini from hallucinating scenery that clashes with what's already there.
Troubleshooting
- Prompt comes out without your description - check the source node, not this one. If it returned an error string, the builder intentionally fell back to the plain prompt.
- Extension still looks unrelated - the description may be too vague. "a room" gives worse results than "a sunlit room with a wooden floor and a window on the right."
There's no tuning here, and that's the point. Give it a good scene description and it makes the rest of the Gemini outpaint pipeline noticeably more coherent - for the cost of one wire.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| scene_context | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |