ComfyUI Node

DSP Image Concat

The 40-line node that glues two images together

By dave-palt·Created 3 years ago·Updated 2 years ago· 0
DSP Image Concat
  • image1
  • image2
  • IMAGE
axis

There are two ways to think about this node: as a tool, and as a lesson. As a tool, DSP Image Concat takes two images and glues them onto one canvas - side by side or stacked. As a lesson, it's about 40 lines of Python that quietly explains the single most confusing thing about how ComfyUI stores images.

It comes from comfyui_DSP_imagehelpers, a one-commit pack by dave-palt that currently contains exactly one node. Don't read "DSP" as anything exotic - there's no API call, no model download, no hidden dependency hiding behind it. It's just the author's prefix on a utility.

Why you'd reach for it

Side-by-side before/after comparisons. Stitching two reference images into a single visual you feed to a ControlNet or IPAdapter. Building a two-up panel for a workflow you're about to export as a PNG. ComfyUI's core batch nodes stack images into a batch - multiple frames stored as one tensor, not one bigger rectangle - so when you actually want "these two images become one image," a tiny concat node like this is exactly the gap-filler you reach for.

How it works

ComfyUI represents every image as a [batch, height, width, channels] tensor. The node does the entire job with one line:

torch.cat([image1, image2], dim=axis_value)

The clever bit is the axis mapping. vertical maps to dim 1 (height), so image2 stacks below image1. horizontal maps to dim 2 (width), so image2 sits to the right. The source even carries a # Adjusted axis_value comment - a tell that the author had the mapping backwards on the first pass, which is the same mistake you'll make writing your own first node. The math is boring, and that's the point.

The inputs that matter

Three inputs, and you only really set two of them:

  • image1, image2 (IMAGE): the two images to join. Order matters - image1 is left / top.
  • axis (horizontal | vertical): which way to glue.

The single IMAGE output is the finished joined canvas. Wire it straight into Preview Image, Save Image, or anything else that eats an IMAGE.

Installing it

Easiest path is ComfyUI Manager: search for comfyui_DSP_imagehelpers, hit Install, restart. No models to fetch, no requirements.txt to fight - the only dependency is torch, which already ships with ComfyUI. If Manager can't find it (fresh packs often lag the registry), clone it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/dave-palt/comfyui_DSP_imagehelpers

Restart ComfyUI and "DSP Image Concat" appears under Image Processing.

Where people get burned

  • Size mismatches. Concatenating horizontally needs both images to have equal heights; vertically needs equal widths. If they don't match, you'll get a torch error along the lines of "Sizes of tensors must match except in dimension 2." Run both through an Image Scale or resize node first to line them up.
  • Batch surprises. If an input carries multiple frames (batch > 1), every non-concat dimension has to line up, and a 2-frame + 1-frame combo will error too. Feed single images and it just works.
  • It only takes two. For a three-up panel you chain two concats, or build a proper grid from a batch instead.

One honest note: the pack has an empty README and no updates since "initial impl." That's fine - it's a single source file short enough to skim before you trust it. Worth the 60 seconds, since custom nodes run their code every time ComfyUI loads, a fact the ecosystem has learned the hard way more than once.

CategoryImage Processing

Inputs (3)

NameTypeDefaultDescription
image1IMAGE
image2IMAGE
axisCOMBO2 options: horizontal, vertical

Outputs (1)

NameTypeDescription
IMAGEIMAGE