Nodes/Duanyll Nodepack/Bounding Box Image Stitcher
ComfyUI Node

Bounding Box Image Stitcher

Stitch a Row of Images Into One Canvas and Get Every Tile's Box

By Duanyll·Created about a year ago·Updated 4 months ago· 2
Bounding Box Image Stitcher
  • images
  • stitched_image
  • bbox
direction
size0

Take a list of images, lay them side by side (or top to bottom), scale them to a common height or width, and hand you both the stitched result and a bounding box for every tile. That's BBoxImageStitcher in one line - a contact-sheet / row-builder node that tracks where everything landed.

It's the assembly step for workflows that work on fragments and then need to present them as one image: crop a face region out of a batch of frames, process each, stitch the results back in a row, and know each tile's coordinates without guessing. The second output - a BBOX list, one per tile, labeled image_0, image_1, … - is what makes that reversible: you can crop back out of the stitched canvas precisely.

How it works

You pick a direction: right stacks images horizontally, down stacks them vertically. Then a size gives the uniform dimension - the common height when going right, the common width when going down. Set size to 0 and it auto-picks the largest dimension among the inputs, so a bunch of mismatched images get scaled to match the tallest (or widest) one. Every image is resized with Lanczos to preserve aspect ratio, pasted onto a fresh canvas, and its position recorded as a BoundingBox.

One subtlety: it's list-mode on input, so you feed a list of images and the node flattens them into the row. Mixed sizes are handled by the resize; uniform sizes just tile cleanly.

Inputs and outputs

  • images - the list of IMAGE tensors to stitch.
  • direction - right (horizontal row) or down (vertical column).
  • size - the uniform height (for right) or width (for down); 0 = auto from the largest input.

Outputs: stitched_image (the combined canvas) and bbox (a list of boxes, one per tile, in order).

Installing it

It's part of Duanyll Nodepack:

cd ComfyUI/custom_nodes
git clone https://github.com/Duanyll/duanyll_nodepack

or via ComfyUI Manager, then restart. Pillow-only - no models to fetch.

Gotchas

The auto-size mode can surprise you: with size=0 and one very tall image in the batch, every other image is resized to that height, which can produce an enormous canvas. If the result is unexpectedly huge, set size explicitly. And because resizing happens to all images, tiles that were already the same size stay untouched - but mixed-size inputs come out normalized, not preserved. Empty input returns a blank 64×64 tensor with an empty bbox list rather than crashing, which is friendly but easy to miss in a larger graph.

Categoryduanyll/bbox

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
directionCOMBO2 options: right, down
sizeINT00–8192

Outputs (2)

NameTypeDescription
stitched_imageIMAGE
bboxBBOX