ComfyUI Node

Image Batch

Jam four inputs into one batch without thinking about it

By wenchengxiang·Created 2 months ago·Updated 9 days ago· 3
Image Batch
  • images_a
  • images_b
  • images_c
  • images_d
  • image

ComfyUI is happiest when images travel as a batch - one tensor with a dimension for "how many images." Samplers can process a whole batch in one pass, and a single Save Image will write every frame of it. The catch is getting separate images into that batch. Image Batch is the pack's answer: up to four IMAGE inputs in, one combined batch out.

The use case that sells it immediately: you generate a fresh image with a KSampler, you load a reference image with Load Image, and you want to feed both to an img2img pass - or just save them side by side. Two separate wires, one batch consumer. Wire both into Image Batch and the node stacks them along the batch dimension with torch.cat, so the output is a single IMAGE batch where each input becomes one or more frames. Each input can itself be a batch, so you can concatenate "two frames from sampler A" with "one loaded reference" and get a clean three-frame batch.

The mechanism is dead simple but it has one hard rule: all inputs must share the same height, width, and channel count. The source checks dimensions and raises a clear error if they don't match - the error message even says "WAS Image Batch Warning," a souvenir of where the author cribbed the check from. Unconnected inputs are skipped entirely, so you never have to wire all four ports; it only stacks what's actually connected.

Inputs and outputs that matter

  • images_a, images_b, images_c, images_d (optional) - any IMAGE, each of which can already be a batch. All must match in H×W×C.
  • image (out) - the concatenated batch.

Installing it

Standard for wenchengxiang/ComfyUI-Practical-Tools. ComfyUI Manager → Custom Nodes Manager → search "ComfyUI-Practical-Tools" → Install → restart. Or clone:

cd ComfyUI/custom_nodes
git clone https://github.com/wenchengxiang/ComfyUI-Practical-Tools

and restart. No pip install, no requirements file, no models - pure Python.

Issues and gotchas

The dimension check is the whole game. Mix a 512×512 gen with a 1024×1024 reference and you get an error, not a stretched image - resize first (a core Image Scale node or one of the pack's transform nodes) and then batch. One more subtlety: the check compares only H×W×C, not batch size, so a batch of 3 and a batch of 1 concatenate fine into 4 frames. And if you ever catch yourself wishing for more than four inputs, the source comments note the list could be extended indefinitely - but for now, four is the ceiling, so plan your fan-in accordingly.

CategoryPractical-Tools/Image

Inputs (4)

NameTypeDefaultDescription
images_aoptIMAGE—
images_boptIMAGE—
images_coptIMAGE—
images_doptIMAGE—

Outputs (1)

NameTypeDescription
imageIMAGE—