ComfyUI Node

Outpaint Setup (Canvas + Flat Image)

Turn one flat image into a 360° outpainting starting point

By cedarconnor·Created about a year ago·Updated 7 months ago· 2
Outpaint Setup (Canvas + Flat Image)
  • flat_image
  • composite_image
  • outpaint_mask
  • stitch_context
canvas_width2048
canvas_height1024
force_2by1_aspecttrue
placement_mode2d_composite
scale1.00
translate_x0
translate_y0
yaw0
pitch0
fov90
feather_size50

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 by scale and pasted into the center of the canvas (with translate_x/translate_y pixel 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: yaw and pitch place it on the globe, fov controls the lens distortion of the projection, and scale controls 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.

CategoryLatLong/Outpaint

Inputs (12)

NameTypeDefaultDescription
flat_imageIMAGESource rectilinear image to place.
canvas_widthINT2048512–8192Width of the equirectangular canvas.
canvas_heightINT1024256–4096Height of the equirectangular canvas (ignored if force 2:1 is enabled).
force_2by1_aspectBOOLEANtrueForce 2:1 aspect ratio (height = width/2). Required for equirectangular format.
placement_modeCOMBO2d_composite2 options: 2d_composite, perspective
scaleFLOAT1.000.01–100Image size multiplier. 1.0 = original size relative to canvas.
translate_xINT0-4096–40962D only: Horizontal pixel offset.
translate_yINT0-4096–40962D only: Vertical pixel offset.
yawFLOAT0-180–180Perspective only: Horizontal view angle.
pitchFLOAT0-90–90Perspective only: Vertical view angle.
fovFLOAT9010–170Perspective only: Field of View at scale=1.0.
feather_sizeINT500–500Inner feathering in pixels.

Outputs (3)

NameTypeDescription
composite_imageIMAGE
outpaint_maskMASK
stitch_contextSTITCH_CONTEXT