Nodes/ComfyUI-UtilsCollection/List to Image Batch (High Performance)
ComfyUI Node

List to Image Batch (High Performance)

Turn a list of images into a batch without the slow path

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
List to Image Batch (High Performance)
  • images
  • images

ComfyUI makes a real distinction between a batch of images (one tensor with N frames stacked on the batch dimension) and a list of images (Python list of separate tensors). Lots of nodes output lists - UC_LoadImageDirectory here outputs one, for instance - and many downstream operations want a proper batch. UC_ListToImageBatch is the bridge, and the "(High Performance)" in its name is the whole story.

It takes a list of images in, returns a single stacked batch out. Where other list-to-batch nodes sloppily resize everything through a slow interpolation path, this one checks whether all images already share the exact same shape - and if they do, it does a direct torch.cat along the batch dimension. No resampling, no per-frame overhead, just one fast concat. That's why it's fast: for the common case where everything already matches, it does almost no work.

The honest edge cases

Two fallbacks in the source are worth knowing because they tell you what happens when things aren't clean:

  • Mixed sizes. If the images don't all match shape, it takes a slower path that resizes to a common resolution. It still works, it just costs time and a little quality.
  • Empty or all-None input. You get back a single 64×64 black image instead of a crash. Useful to know, because it means a bug upstream won't necessarily error loudly - it'll hand you a black frame.

One input (images, an IMAGE list), one output (images, a single IMAGE batch). That's the whole API.

When you'd actually use it

Chain it after anything that yields a list: directory loaders, per-frame sampling loops, batch-processing utilities from other packs. The output feeds anything that expects a batch - a VAE decode, an upscaler that processes whole batches, a SaveImage that writes them all, or a sampler's latent batch. If your pipeline is already batch-shaped end to end, you never see this node. The moment you mix a list-producing node in, it's the adapter that keeps the rest of your graph simple.

Install

Part of silveroxides/ComfyUI-UtilsCollection:

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection

Restart (or ComfyUI Manager → search "ComfyUI-UtilsCollection"). Pack deps are just opencv-python and typing-extensions.

One practical tip: because the fast path depends on identical shapes, you'll get more out of this node if you normalize resolution before the list is built - the pack's UC_ImageAndMaskResize is a natural partner. Feed it a list of mixed resolutions and it'll still work, but you're paying the slow path you were trying to avoid.

Categoryutils

Inputs (1)

NameTypeDefaultDescription
imagesIMAGE

Outputs (1)

NameTypeDescription
imagesIMAGE