Stitch Images
Put two images side by side, spacer bar optional
- image1
- image2
- IMAGE
Side-by-side comparisons are the native language of this community - before/after, original vs outpainted, seed A vs seed B. ImageStitch is the built-in that makes those grids. It takes two images and glues them together in the direction you pick, optionally with a colored spacer strip between them.
Fun fact: this one was upstreamed into ComfyUI core from Kijai's KJNodes, which is how a lot of the good utility nodes get in - prove it in a popular pack long enough and it lands in the base install. Nothing to install today.
How it works
Wire in image1 and image2, pick a direction (right, down, left, up, default right), and it concatenates them along that axis. Two details do the real work:
- match_image_size (default on) - if the two images have different dimensions, image2 gets resized so the stitching edge lines up: for a horizontal stitch it scales image2's height to match image1 (aspect preserved), for a vertical stitch it matches width. That's what makes clean before/after grids without you doing the resizing by hand. Turn it off and the smaller image gets padded with the alignment color instead - pixels stay untouched, but you get bars.
- spacing_width / spacing_color - insert a gap between the images. Spacing snaps to even numbers, and the color options are white, black, red, green, blue. Zero spacing (the default) is a hard join.
It also handles the messy cases: batches of different lengths repeat the last frame so both sides line up, and channel counts get padded to match.
Inputs and output
- image1 (required), direction, match_image_size, spacing_width, spacing_color (all with sane defaults)
- image2 (optional) - if you leave it disconnected, the node just returns image1 unchanged, which is a handy way to build a "conditional stitch."
Output is a single IMAGE: both images (and any spacer) concatenated into one tensor. You can chain stitches to build a three- or four-up grid.
Why you'd use it
- Before/after, original vs generated - the highest-value use. Stitch the source and the result, save one image, share it.
- Comparison grids for A/B testing prompts, seeds, samplers, LoRA strengths.
- Assembling crops or tiles back into a row - the natural partner to the crop nodes when you've sliced something up.
- Quick reference sheets - face refs, style refs, character sheets built in one pass.
Where it bites
- The resize is on image2, always. If you stitch the "wrong" direction or feed the "wrong" image first, the second one takes the resizing hit. For before/after you almost always want the original as image1 so the original stays pixel-exact.
- Turning off match_image_size means padding, not cropping. Mismatched sizes become a center-aligned stack with bars, which is fine - just know it.
- The colored spacer is a real feature, not a bug. Stitch two images with a 200px red gap, feed the result to an instruction model, prompt it to "remove the red bar," and you've built the community's favorite low-effort outpainting trick - the model fills the gap with whatever's behind it. The red (plus white and black) options exist for exactly this.
- Batch mismatches silently repeat the last frame, so a 5-frame image1 with a 1-frame image2 gives you the same image2 five times. Usually what you want; worth knowing.
Simple, fast, and the least-effort way to make a comparison that people can actually read.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image1 | IMAGE | — | |
| direction | COMBO | right | 4 options: right, down, left, up |
| match_image_size | BOOLEAN | true | — |
| spacing_width | INT | 00–1024 | — |
| spacing_color | COMBO | white | 5 options: white, black, red, green, blue |
| image2opt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |