Nodes/ComfyUI-Light-Tool/Light-Tool: Image Concat
ComfyUI Node

Light-Tool: Image Concat

Side-by-side and stacked grids in one node, no math required

By ihmily·Created 2 years ago·Updated 4 months ago· 20
Light-Tool: Image Concat
  • image1
  • image2
  • image3
  • image4
  • image5
  • image
  • mask
directionhorizontal

If you've ever built a before/after comparison, a prompt-variation grid, or a contact sheet in pure ComfyUI, you know the ritual: a couple of resizes, a carefully chosen concat node, and then a prayer that the dims line up. Light-Tool: ImageConcat is the "stop fiddling" version of that. It stitches up to five images into a row or a column and hands you the result.

The only real controls are the ones you'd expect: image1 and image2 are required, image3 through image5 are optional, and direction flips between horizontal and vertical. That's the whole UI. Drop in your images, pick a direction, done.

The mechanism. Under the hood it's plain PIL pasting. For horizontal it takes the height of the first image, makes a canvas the sum of all widths, and pastes each image in sequence. Vertical works the same way swapped around. Two things fall out of that design:

  • All images must share the joining dimension. Horizontal concat demands matching heights; vertical demands matching widths. Mismatch and it raises a ValueError telling you exactly which heights don't line up - so you'll spend a resize node or two getting frames to agree first. This pack's own ResizeImage is the natural partner.
  • There's no automatic scaling. If you feed a 512px and a 768px image into a horizontal join, it will error rather than quietly stretch one. Arguably that's the right call for a tool that's usually building reference grids where fidelity matters.

The outputs. You get image and a mask. The mask is the pack's doing, not yours to care about much: it's literally the red channel of the joined result turned into a MASK tensor. It exists so the node's signature fits downstream compositing nodes, but for a comparison grid you'll wire image into a preview or saver and never look at the mask.

Where it earns its place. This is one of those nodes you don't need every day, then suddenly need four times in an afternoon. Building side-by-side input pairs for an IP-Adapter or reference workflow, grid-mounting upscaled tiles, or just making a clean two-up of "before vs after" for a post - all of it is one node instead of a three-node dance.

Installing. The whole pack ships together, so you get this one for free when you install ComfyUI-Light-Tool. Easiest: ComfyUI Manager → Custom Nodes → search ComfyUI-Light-Tool → Install → restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/ihmily/ComfyUI-Light-Tool.git
pip install -r requirements.txt
# restart ComfyUI

No model downloads, no checkpoints - the "light" in the name is doing real work here. The heavy bit is opencv-python in requirements, which most ComfyUI installs already have.

Gotchas. ComfyUI's own concat nodes exist, but core ImageConcatenate wants same-size images and joins along the batch dimension rather than the edge; this one is for the edge-paste case. And a genuinely weird quirk: the mask output is computed from the joined image's red channel, so don't treat it as a semantic mask. For a grumpy comparison grid where the sides don't match, ResizeImage with a shared height is your fix - not this node's problem, but yours.

CategoryComfyUI-Light-Tool/image/compositing

Inputs (6)

NameTypeDefaultDescription
image1IMAGE
image2IMAGE
directionCOMBOhorizontal2 options: horizontal, vertical
image3optIMAGE
image4optIMAGE
image5optIMAGE

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK