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

Deconcatenate Batch Horizontally

Splitting a Stitched Batch Back Apart — Without Guessing at the Middle

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

"Deconcatenate Batch Horizontally" is the other half of the Pixel-Forge stitch pair. Where ConcatenateBatchHorizontally glues two batches side by side, this one tears them back apart. If you've ever built a "split an image at the middle" node and watched it butcher the result, this is the node that does it properly - because it doesn't split at the middle.

How it works

Two inputs:

  • images (IMAGE) - the stitched batch
  • original_width_a (INT) - how wide the A side was before the stitch

For each row, it cuts the image vertically at original_width_a, giving you the original A on the left and B on the right. That recorded width is the whole trick. The stitch node pads vertically when A and B differ in height, but width is untouched, so the horizontal split point is exact - no guesswork, no 50/50 assumption that silently clips the wider side.

It then normalizes the outputs: A rows and B rows get padded to their group's maximum width (centered) so each output comes back as a clean rectangular batch. So the round-trip A → stitch → de-stitch reproduces both batches, modulo that width padding on the B side if the inputs varied.

The one thing to get right

original_width_a is not a number you invent. The concat node emits it as its second output specifically so you can feed it straight into this node's input. It's actually a small per-image tensor (one width per batch row), and this node checks that its batch size matches images - a hardcoded integer will fail when your batch is bigger than one, because it has no .shape[0] to compare. Wire the two nodes together and it just works.

Both inputs are required, and there's no threshold or knob to fiddle with. If you find yourself adjusting anything, you're probably holding it wrong.

Installing it

Same as the rest of the pack. ComfyUI Manager: search "ComfyUI-Pixel-Forge", install, restart. Or:

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

restart ComfyUI, and the node shows up under the Pixel_Forge/Batch menu. No model downloads - this is pure tensor slicing.

Troubleshooting

  • "must have the same number of images" / batch-size mismatch on original_width_a: you're feeding a scalar instead of the concat node's output. Re-route it.
  • Black bars in the output: those are the width-padding normalization, and they're cosmetic. If you need pixel-perfect halves and you know the original widths were identical, you can crop them off downstream; otherwise ignore them.
  • The pack is brand new and thinly documented - the README is scaffolding and documents no nodes. The good news is the code is small, MIT-licensed, and easy to read if you want to verify exactly what a split does.
CategoryPixel_Forge/Batch

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
original_width_aINT

Outputs (2)

NameTypeDescription
images_aIMAGE
images_bIMAGE