Outpaint Setup (Canvas + Flat Image)
Turn one flat image into a 360° outpainting starting point
- flat_image
- composite_image
- outpaint_mask
- stitch_context
Outpainting a flat image into a full 360° panorama is one of the coolest tricks in this corner of the hobby - take one normal photo and let the model invent the rest of the world around it. Outpaint Setup is the node that prepares the ground for exactly that.
It does three things in one go: it places your flat (rectilinear) image onto a transparent equirectangular canvas, it produces the mask saying "everything except the source image is what the model should generate," and it bundles up a stitch_context that the matching Outpaint Stitch node uses later to lay your crisp original back on top of the generation. Setup → inpaint → stitch is the whole workflow, and this is the first step.
How it works
Two placement modes, picked with placement_mode:
2d_composite(default) - the simple one. Your image is scaled byscaleand pasted into the center of the canvas (withtranslate_x/translate_ypixel offsets to nudge it around). Fine for drafts and for images that should sit flat and large in the frame.perspective- the one that makes it look real. Your image is projected onto the sphere:yawandpitchplace it on the globe,fovcontrols the lens distortion of the projection, andscalecontrols how much of the panorama the image covers (a bigger source at the same FOV covers more, without adding distortion). This is the mode you want when the flat image is supposed to be "a view out of this room" rather than "a poster taped to the wall."
feather_size (default 50) feathers the inner edge of the source image so the boundary where the model takes over is soft instead of a hard cut. The mask it outputs is standard inpainting convention: 1 = generate here, 0 = keep - and it's built as the inverse of the source's alpha, so the feather turns into a soft mask gradient where generation blends into your image.
force_2by1_aspect (on by default) pins the canvas to 2:1 by ignoring canvas_height and setting it to canvas_width / 2 - the only aspect a valid equirectangular can have. Keep it on.
Inputs and outputs
flat_image(required) - your source rectilinear image.canvas_width(2048) /canvas_height(1024) - canvas size; height is ignored while 2:1 is forced.placement_mode,scale,translate_x/translate_y(2D only),yaw/pitch/fov(perspective only),feather_size.
Three outputs, and they map to the three jobs: composite_image (the canvas with your image on it - the inpaint reference), outpaint_mask (where the model should generate), and stitch_context (a data bundle of the original image + placement params, for the Stitch node only).
Installing it
Pack install as usual - Manager search "LatLong", or:
cd ComfyUI/custom_nodes
git clone https://github.com/cedarconnor/comfyui-LatLong
cd comfyui-LatLong
pip install -r requirements.txt
Restart ComfyUI. Under LatLong/Outpaint. Deps: numpy, opencv-python, scipy, torch, Pillow; no models.
Gotchas
The output types are the gotcha. stitch_context is a custom STITCH_CONTEXT type that only the pack's Stitch node consumes - don't expect to wire it into anything else, and don't lose it, because without it the Stitch node has nothing to work with. And remember the mask semantics: outpaint_mask is 1 where the model generates, so if you're used to inpainting masks being "1 = keep this," flip your mental model. One more: the composite canvas starts transparent, but ComfyUI IMAGE is RGB - the transparency lives in the mask, not in an alpha channel, so if the canvas looks black where it should be empty, that's expected until you use the mask with a proper inpaint encode.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| flat_image | IMAGE | Source rectilinear image to place. | |
| canvas_width | INT | 2048512–8192 | Width of the equirectangular canvas. |
| canvas_height | INT | 1024256–4096 | Height of the equirectangular canvas (ignored if force 2:1 is enabled). |
| force_2by1_aspect | BOOLEAN | true | Force 2:1 aspect ratio (height = width/2). Required for equirectangular format. |
| placement_mode | COMBO | 2d_composite | 2 options: 2d_composite, perspective |
| scale | FLOAT | 1.000.01–100 | Image size multiplier. 1.0 = original size relative to canvas. |
| translate_x | INT | 0-4096–4096 | 2D only: Horizontal pixel offset. |
| translate_y | INT | 0-4096–4096 | 2D only: Vertical pixel offset. |
| yaw | FLOAT | 0-180–180 | Perspective only: Horizontal view angle. |
| pitch | FLOAT | 0-90–90 | Perspective only: Vertical view angle. |
| fov | FLOAT | 9010–170 | Perspective only: Field of View at scale=1.0. |
| feather_size | INT | 500–500 | Inner feathering in pixels. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| composite_image | IMAGE | — |
| outpaint_mask | MASK | — |
| stitch_context | STITCH_CONTEXT | — |