Nodes/ComfyUI-Pixel-Forge/Concatenate Batch Horizontally
ComfyUI Node

Concatenate Batch Horizontally

Two Image Batches, Side by Side — and the Width You'll Need to Split Them Back

By ThunderBolt4931·Created 12 months ago·Updated 9 months ago· 6
Concatenate Batch Horizontally
  • images_a
  • images_b
  • image
  • original_width_a

"Concatenate Batch Horizontally" is a ComfyUI node from the Pixel-Forge pack that takes two image batches and stitches them together side by side, element by element. If your workflow makes before/after grids, reference-vs-candidate comparisons, or pairs of crops that need to sit next to each other, this is the glue.

What it actually does

You feed it two inputs:

  • images_a (IMAGE)
  • images_b (IMAGE)

Both must have the same batch size and the same number of channels, or it raises a clear error. For each row in the batch, it takes image A and image B, and here's the detail that matters: it doesn't assume they're the same height. It pads the shorter one with black to match the taller one (padding is split top/bottom, so it stays centered), then concatenates horizontally.

The output image is a single IMAGE batch where row N is A[N] glued to B[N].

The second output is where this node gets clever, and it's easy to miss: original_width_a (INT). That's the width of the A side before the stitch, recorded per image. It exists for one reason - to feed back into the pack's DeconcatenateBatchHorizontally node, which splits the stitched result at the true width of A rather than guessing a 50/50 split. That matters because the two sides can have different widths (totally normal), and a 50/50 guess cuts straight through the middle of whichever side is wider. Passing the real width along makes the round-trip exact - and since the stitch pads vertically (not horizontally) when heights differ, the horizontal cut point is clean regardless.

How to use it

Wire two IMAGE batches into it, take image wherever you need the side-by-side, and if you're going to split later, run original_width_a straight into the Deconcatenate node's input of the same name. Don't hand-type that number - it's a small per-image tensor, not a single integer you should retype, and the deconcatenate node expects it to match the batch.

Installing it

Pixel-Forge installs like any ComfyUI custom node. Easiest is ComfyUI Manager: search for "ComfyUI-Pixel-Forge" and hit install, then restart. Or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/ThunderBolt4931/comfyui_pixel_forge

then restart ComfyUI. The pack pulls in scipy, transformers, lpips and open_clip_torch via its requirements - this particular node only needs the base image math, but the pack's dependencies install all at once, so the first install can take a minute. There are no model files to download for the batch nodes.

Things that bite

  • Batch size mismatch throws a ValueError: "Input image batches must have the same number of images." If you're feeding it a single image and a batch, batch the single one first.
  • The black vertical padding can show up as bars if you later split and stare at the raw halves - that's expected, not a bug.
  • This is a brand-new pack (committed December 2025, essentially zero community footprint as of writing). The README is scaffolding and documents none of the nodes, so treat behavior as verified-by-source, and if something acts up, it's early enough that you're probably finding the first bug.
CategoryPixel_Forge/Batch

Inputs (2)

NameTypeDefaultDescription
images_aIMAGE
images_bIMAGE

Outputs (2)

NameTypeDescription
imageIMAGE
original_width_aINT