ComfyUI Node

Smart Image Stitch

The stitcher that doesn't care which inputs are empty

By Niutonian·Created 7 months ago·Updated 7 months ago· 0
Smart Image Stitch
  • image_1
  • image_2
  • image_3
  • image_4
  • image_5
  • image_6
  • stitched_image
directionright
alignmentcenter
resize_modenone
resize_methodlanczos
aspect_ratio_handlingpad
spacing0
background_colortransparent

You generated four variations of the same prompt and you want them in one strip for a side-by-side. Or a before/after pair for a LoRA test. Core ComfyUI doesn't give you a clean way to do that - it's exactly the kind of "post-processing" task that ships as a custom node. Smart Image Stitch is the flagship of the Niutonian Smart Image Suite, and it does one thing: paste up to six images into a single strip along a direction you pick, and hand you back one IMAGE.

The first thing worth knowing: this is plain Pillow/numpy under the hood. No models, no API, no keys, nothing to download. The "smart" is in the input handling - it silently drops empty or bypassed inputs, so you can leave image_5 and image_6 unplugged and it just stitches what's actually there. That alone makes it friendlier to template workflows than the built-in stitchers, which usually throw a size-mismatch tantrum the moment an input goes missing.

How it works

Wire image_1 through image_6 (all optional) into a generation or upscale pipeline, then set the controls. It grabs whatever images are present, optionally resizes them all to a common size, lines them up along direction (left/right/top/bottom), and pastes them onto a canvas with spacing pixels between each and background_color filling the gaps. Left and top directions reverse the input order so image_1 ends up at the leading edge.

The inputs a beginner actually sets:

  • direction - which way the strip grows. Right is the default and covers most comparison-sheet cases.
  • resize_mode - none keeps each image at its native size (then alignment decides if short ones sit at start, center, or end). largest/smallest normalize everyone to a common box.
  • aspect_ratio_handling - how images are forced into that box: pad letterboxes, crop center-crops to fill, stretch distorts. Pad is the one you want 90% of the time.
  • spacing - gap in pixels between images, handy for annotated contact sheets.

Output is stitched_image (IMAGE), which plugs straight into a Save Image, a preview, or anything else that eats an IMAGE.

Where people get burned

Two behaviors to know before they surprise you. longest_side and shortest_side in resize_mode don't just normalize - they square everything up to one dimension, which is rarely what you want for a landscape strip. And "transparent" only shows through where your source images actually have alpha. RGB images get pasted opaque, so if you want real transparency you need RGBA sources, e.g. output from a background-removal node. If no inputs at all are connected, it returns a small gray 100x100 placeholder rather than erroring - which is arguably friendlier than it deserves to be.

Installing it

The pack is called comfyui-niutonian-smart-image and the whole suite lands under Niutonian/Image Processing. Easiest path:

cd ComfyUI/custom_nodes
git clone https://github.com/Niutonian/comfyui-niutonian-smart-image

Then restart ComfyUI. Or use ComfyUI Manager and search "Niutonian" - the pack shows up under that name. Its requirements.txt is just torch, torchvision, numpy and Pillow, all of which ComfyUI already ships, so there's nothing heavy to pull and no model downloads. If you see cv2 errors, that's the Panorama node's dependency, not this one - this node runs on pure Pillow.

It's a young pack (the whole suite landed in a single commit in early 2026) from an author best known for the Niutonian ComfyUI themes, so treat it as a quality-of-life utility, not a deeply battle-tested tool. For plain linear stitching it's the one I'd reach for before wiring up three different crop-and-concat nodes by hand.

CategoryNiutonian/Image Processing

Inputs (13)

NameTypeDefaultDescription
directionCOMBOright4 options: left, right, top, bottom
alignmentCOMBOcenter3 options: start, center, end
resize_modeCOMBOnone5 options: none, largest, smallest, longest_side, shortest_side
resize_methodCOMBOlanczos4 options: lanczos, bilinear, bicubic, nearest
aspect_ratio_handlingCOMBOpad3 options: pad, crop, stretch
spacingINT00–100
background_colorCOMBOtransparent3 options: transparent, white, black
image_1optIMAGE
image_2optIMAGE
image_3optIMAGE
image_4optIMAGE
image_5optIMAGE
image_6optIMAGE

Outputs (1)

NameTypeDescription
stitched_imageIMAGE