Stack Images (mtb)
Tile images side-by-side or top-to-bottom in ComfyUI
- IMAGE
Need a side-by-side comparison, a before/after, or a little contact sheet of variations? Stack Images (mtb) glues images together - horizontally or vertically - into one image. It's the node you reach for to build those "left is the original, right is the result" panels without opening an editor.
The nice touch is that it uses dynamic inputs: instead of being locked to two images, you add as many input slots as you need and it stacks all of them in order. So it's not just A-next-to-B; it's a whole row (or column) of frames combined into a single output. Great for comparison grids, for laying out a batch of prompt variations to eyeball at once, or for assembling a filmstrip.
It's in the image-utils corner of MTB Nodes (comfy_mtb) by melMass, and it's clearly one people find useful - it punches above its weight in search.
How it works
It takes your connected images and concatenates them along one axis - horizontal or vertical - into a single canvas. Internally it normalizes everything to RGBA (it accepts RGB or RGBA and converts as needed), which is why transparency survives the stack. There's one real constraint: for the join to work the images have to agree on the perpendicular dimension. Stacking vertically, they must share the same width; stacking horizontally, the same height. The match_method option decides what happens when they don't.
The inputs and outputs that matter
vertical(default off) - the direction. Off stacks side-by-side (a row); on stacks top-to-bottom (a column).- the image inputs - dynamic, so you wire in as many as you want and they're stacked in connection order.
match_method(optional: error / smallest / largest, defaulterror) - how to reconcile mismatched sizes.errorrefuses and tells you (the strict default - it won't silently distort anything).smallestscales everything down to the smallest,largestscales up to the largest. Switch offerrorwhen you want the node to auto-fit mismatched images.output_rgb(optional, default on) - return RGB instead of the internal RGBA, handy when the next node doesn't want an alpha channel.
Output is a single IMAGE - the combined strip.
How to install it
ComfyUI Manager: search MTB Nodes, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/melMass/comfy_mtb
then restart. Pure Python, no models, nothing extra.
Common issues & troubleshooting
"Images don't match" error. That's match_method set to error (the default) meeting images of different sizes. Either resize them to share the relevant dimension - width for vertical stacks, height for horizontal - or set match_method to smallest/largest to let the node scale them to fit.
Adding a second image doesn't add a slot. Stack Images uses dynamic inputs; the new slot appears once you connect to the existing empty one. If you're not seeing more inputs, connect what's there first and the next slot shows up.
A stretched-looking result. smallest/largest scale images to match, and if their aspect ratios differ, one gets distorted to fit. If that's ugly, crop or pad to a common shape upstream instead of relying on auto-fit.
Unexpected transparency downstream. The node works in RGBA internally. If a later node misbehaves with the alpha channel, turn output_rgb on to hand it plain RGB.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| vertical | BOOLEAN | false | — |
| match_methodopt | COMBO | error | 3 options: error, smallest, largest |
| output_rgbopt | BOOLEAN | true | Output RGB instead of RGBA |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |