Nodes/Panoramic Image Stitcher/Panoramic Image Stitcher
ComfyUI Node

Panoramic Image Stitcher

Stitch overlapping tiles into one panorama without leaving the graph

By RodrigoSKohl·Created 2 years ago·Updated about a year ago· 8
Panoramic Image Stitcher
  • images
  • IMAGE
◄crop▾►
◄mode▾►
â—„conf_thresh1.00â–º
â—„work_megapix0.60â–º
â—„seam_megapix0.10â–º

You've got four overlapping tiles of the same scene and no way to turn them into one wide image. That's the gap this node fills. ComfyUI will happily batch-generate tiles or outpaint sideways until the cows come home, but nothing in the core nodes knows how to glue overlapping images together with proper perspective correction - that's the job OpenCV's stitcher was built for, and this is a thin, honest wrapper around it.

The name is not an exaggeration and there's no catch: it calls no API, needs no key, downloads no model. It's the cv2.Stitcher function, wrapped into a node and wired back into the tensor world. For a hobby-grade panorama or a wide generated image, that's usually all you need.

How it works

Feed it a batch of images on the images input - the order of the batch is the order they'll be stitched in, so get the sequence right. The node converts each tensor back to BGR, hands the whole stack to OpenCV's stitcher, and the stitcher finds feature matches between adjacent frames, estimates homographies, warps everything onto a common plane, and blends the overlaps.

The mode input picks which stitcher you get:

  • panoramic (default) - the general photo-stitcher mode, meant for wide-angle scenes and overlapping camera shots.
  • scans - OpenCV's document/text mode, tuned for flat, front-on scans where you're merging a wider page out of overlapping captures.

Under the hood it's setting three knobs on the stitcher: the confidence threshold for accepting a match, the resolution used for registration (finding the matches), and the resolution used for seam estimation (finding the best blend line). That's it. No neural network, no VRAM blowup - this all runs on CPU via OpenCV.

The inputs that actually matter

The defaults are sane, and for the first attempt you should change exactly two things:

  • crop - enable (default) crops to the smallest rectangle that contains the whole panorama, trimming the black/empty regions around the warped edges. Leave it on unless you have a reason not to.
  • mode - switch to scans only if you're stitching documents or text.

The other three are float sliders you'll probably never touch. conf_thresh (default 1.0) is the match-acceptance bar - lowering it makes the stitcher more permissive and is the classic source of misaligned seams, so keep it at 1.0. work_megapix (default 0.6) is the registration resolution; if your tiles are huge and stitching fails to find matches, bump this up. seam_megapix (default 0.1) is the seam-estimation resolution - lower is faster, slightly lower quality.

The output

One IMAGE tensor: the finished panorama. Wire it into a PreviewImage to see what you got, then into a SaveImage or upscaler. One detail worth knowing: with crop set to disable, the node returns an RGBA image - the alpha channel is a mask that makes the black warped border transparent, not just black. That's handy if you want to drop the result onto a background or feed the mask elsewhere instead of hard-cropping it.

Install

ComfyUI Manager has it under "Panoramic Image Stitcher", or:

cd ComfyUI/custom_nodes
git clone https://github.com/RodrigoSKohl/ComfyUI-Panoramic-ImgStitcher
# restart ComfyUI

The only Python dependency is opencv-python, which most installs already have because a dozen other custom nodes pull it in. If your ComfyUI doesn't have it, you'll know immediately: the node imports cv2 at module load, so the whole pack fails to import and every workflow using it errors. That's a pip install opencv-python in your ComfyUI environment and a restart.

Where people get burned

The README's own FAQ is honest about the failure modes, and they're real. Error 1 means the stitcher couldn't find enough matching points - your tiles have too little overlap, or they're downscaled so hard that the details got destroyed. Fix it by overlapping the tiles more, adding intermediate images, or raising work_megapix and seam_megapix. This is the failure you'll hit with loosely-spaced generated tiles, because generative output doesn't line up pixel-perfectly the way a photo burst does - more overlap is the cure, not more resolution. Error 3 is the confidence-threshold trap: if you lowered conf_thresh to force it through, this is what you get - a panorama that stitches but looks subtly wrong. Also note it needs at least two images; a single tile raises a ValueError.

Is this the most glamorous node in your graph? No. It's a utility - but when you need a wide image out of overlapping tiles, it's the one I'd reach for over hand-wrangling masks, because OpenCV's stitcher is battle-tested and this costs you nothing to try.

Category🧩 Custom Nodes

Inputs (6)

NameTypeDefaultDescription
imagesIMAGE—
cropCOMBO2 options: enable, disable
modeCOMBO2 options: panoramic, scans
conf_threshFLOAT1.000–1—
work_megapixFLOAT0.600.001–100—
seam_megapixFLOAT0.100.001–100—

Outputs (1)

NameTypeDescription
IMAGEIMAGE—