ComfyUI Node

Outpaint Stitch (High-Res Composite)

Put your crisp source image back over the generation

By cedarconnor·Created about a year ago·Updated 7 months ago· 2
Outpaint Stitch (High-Res Composite)
  • generated_equirect
  • stitch_context
  • final_equirectangular
blend_modealpha

Outpaint Stitch is the payoff node of the pack's outpainting workflow - the one that makes the whole thing worth it. After Setup gives you a canvas and a mask, after KSampler generates the rest of your 360° world, this node lays your original, full-resolution source image back over the generated result.

Why is that step so important? Because the panorama you generate is usually at a modest resolution (the latent you can fit in VRAM), and the model's version of your source photo is a re-drawn, downscaled, subtly-wrong copy of it. Your original photo has detail the generation will never match. So the trick is: let the model invent everything around the source, then replace the model's rendition of the source with the real thing. Your flat image stays pin-sharp, and the invented world wraps around it.

How it works

The node re-projects the original high-res flat image onto the generated panorama's canvas, at the generation's resolution, using the exact placement parameters saved in stitch_context by the Setup node. It computes the scale factor between the setup canvas and the actual generated resolution (W_gen / setup_width), re-renders the source at that scale (bilinear upsample), re-applies the same feather, and composites it over the generated image using the feather as the alpha blend - the familiar alpha * source + (1 - alpha) * generated formula. Because the source is re-projected from the original high-res image rather than scaled up from the generated copy, you keep the source's original detail even when the generation ran smaller.

The blend_mode input picks the compositing flavor: alpha (default) does the feathered alpha blend; overlay and hard are the other two options - harder edges, less blending - for when the soft feather isn't what you want. It also prints a batch of [Stitch Debug] lines to the console showing the shapes it's working with, which is genuinely useful the first time you wire it up and something doesn't line up.

Inputs and outputs

  • generated_equirect (required) - the result from your KSampler/inpaint pass.
  • stitch_context (required) - the data bundle from Outpaint Setup. It holds the original image, the placement mode, scale, yaw/pitch/fov, and canvas size.
  • blend_mode - alpha / overlay / hard, default alpha.

Output is a single final_equirectangular, ready for the Edge Blender as your last polish step.

Installing it

Standard LatLong pack install:

cd ComfyUI/custom_nodes
git clone https://github.com/cedarconnor/comfyui-LatLong
cd comfyui-LatLong
pip install -r requirements.txt

Or ComfyUI Manager → search "LatLong" → restart. Under LatLong/Outpaint. Deps: numpy, opencv-python, scipy, torch, Pillow; no models.

Gotchas

The pairing is the whole game: Stitch is useless without the stitch_context from Setup, and Setup's context is useless anywhere else. Keep them as a matched pair in your workflow. Also note Stitch assumes the generated image is at or above the setup canvas resolution - it re-scales the source to match whatever the generator produced, so if you generated smaller than the setup canvas, the source gets downscaled and you lose the "crisp original" benefit (it's not a super-resolution node). And if your source looks soft after stitching, check feather_size in Setup: a big feather means the model's version bleeds over more of your photo's edges, and the "sharp" region shrinks to the center.

CategoryLatLong/Outpaint

Inputs (3)

NameTypeDefaultDescription
generated_equirectIMAGEThe generated/outpainted result.
stitch_contextSTITCH_CONTEXTContext from Setup node.
blend_modeCOMBOalpha3 options: alpha, overlay, hard

Outputs (1)

NameTypeDescription
final_equirectangularIMAGE