Nodes/comfyui-huyl2-nodes/Image Concatenate (Auto Direction)
ComfyUI Node

Image Concatenate (Auto Direction)

Stitch two images without picking left/right yourself

By huyl3-cpu·Created 9 months ago·Updated 4 months ago· 1
Image Concatenate (Auto Direction)
  • image1
  • image2
  • image
  • direction
match_image_sizetrue

Most concat nodes make you decide up front: horizontal or vertical. This one skips that decision - feed it two images and it figures out which way to join them, then tells you which way it picked.

Why you'd want this

Handy anywhere you're building a comparison image or a strip out of two frames and don't want to hardcode the orientation - a before/after pair, two frames pulled from a video for a quick visual diff, a report image built dynamically where the source images' shapes might vary run to run. Instead of wiring a conditional to pick between a horizontal-concat and a vertical-concat node, this one node handles both cases and reports back which it used.

How it works

Reading the schema, the most plausible mechanism is that it compares the two images' dimensions or aspect ratios and picks whichever join axis produces a sane result - two portrait images side by side, two landscape images stacked, that sort of logic. It doesn't leave you guessing after the fact either: the direction output tells you exactly which way it went.

Inputs and outputs

  • image1, image2 (IMAGE, required) - the two images to join.
  • match_image_size (BOOLEAN, default true) - resizes one image to match the other before joining, so mismatched dimensions don't produce a lopsided result at the seam.
  • Outputs: image (IMAGE, the combined result) and direction (STRING, which way it joined them).

Installing it

No models or extra dependencies mentioned in the README. Search ComfyUI Manager for the repo name first; as a small personal pack it may not be indexed, in which case the manual route works:

cd ComfyUI/custom_nodes
git clone https://github.com/huyl3-cpu/comfyui-sortlist.git

Restart ComfyUI afterward.

Common issues and troubleshooting

There's no manual override for direction. If you need a specific orientation every time - always side-by-side, say, regardless of what the images look like - this node won't give you that control. The schema exposes only match_image_size, nothing that lets you force horizontal or vertical. If a fixed direction matters to your workflow, a plain concat node from a more general-purpose pack is the better fit.

With match_image_size off, mismatched images still get joined as-is. Turning that toggle off doesn't add a warning or block the operation - expect a visibly uneven seam where the two images' edges don't line up, rather than an error telling you the sizes don't match.

Check direction if the result looks off. Since the node is making the layout decision for you, the direction output is your one window into what it actually did. Wire it into a text-display node the first time you use this in a new pipeline, so you're not surprised by which way it stitched things.

Categorysortlist

Inputs (3)

NameTypeDefaultDescription
image1IMAGE
image2IMAGE
match_image_sizeBOOLEANtrue

Outputs (2)

NameTypeDescription
imageIMAGE
directionSTRING