ComfyUI Node

Image List To Batch

The Glue Node That Gets Your Frame Lists Back Into a Batch

By kinorax·Created 5 months ago·Updated about a month ago· 2
Image List To Batch
  • image
  • image
  • frame_count

ComfyUI has two ways of handing you several images at once: a batch (one tensor with an extra dimension, rank-4) and a list (a Python list of separate tensors). They look the same on screen until something downstream only accepts one of them. Video frame interpolation (VFI) nodes are the classic offender - they want a real batch, and if the node feeding them gives you a list, you get a type error or, worse, it silently processes one frame.

IPT-ImageListToBatch is the bridge. It takes list-expanded IMAGE inputs - the kind of thing Video Reader in this same pack emits, or any node with a "output as list" mode - and merges them into a single rank-4 IMAGE batch. If you've ever stared at a VFI node complaining about input shape, this is the fix.

How it works

Under the hood it flattens whatever shows up on the image input, then does one of two things per tensor: a 3D tensor (a single frame, C,H,W) gets a batch dimension added, and a 4D tensor (already a batch) is kept as-is. All of them get concatenated into one tensor, so 10 separate frames in, 1 batch of 10 out. The second output, frame_count, is just that number as an INT - handy if a downstream node wants to know how many frames it's dealing with without you counting wires.

It's a deliberately dumb node, and that's the point. No resizing, no padding, no cleverness. Pure shape surgery.

Inputs and outputs that matter

  • image (required, IMAGE) - the list-expanded frames to merge. Wire the list output of a Video Reader or similar here.
  • image (output, IMAGE) - the merged batch, ready for VFI nodes or anything else that wants rank-4.
  • frame_count (output, INT) - number of frames in the batch.

Installing it

This ships in the kinorax/comfyui-info-prompt-toolkit pack, so you get all ~90 nodes with one install:

cd ComfyUI/custom_nodes
git clone https://github.com/kinorax/comfyui-info-prompt-toolkit.git
cd comfyui-info-prompt-toolkit
pip install -r requirements.txt

Then restart ComfyUI. ComfyUI Manager works too - search "ComfyUI-Info-Prompt-Toolkit". The requirements file pulls in timm, regex, cryptography and a few others, most of which exist to serve the pack's SAM3 and tagger nodes; this one just needs the base environment. Note the pack targets ComfyUI 0.17.0+, it's built on the newer comfy_api.latest node API, so update if you're on an old build.

Common issues

The one real gotcha is that all frames need to be the same resolution and channel count, because they're being stacked into one tensor. Mixing a 512×512 frame with a 768×768 frame fails - no graceful fallback, no auto-crop. If you're feeding it from Video Reader, make sure frames were decoded consistently. Also, if the input arrives already batched and you're getting a list wrapped around it, this node still handles it (a 4D tensor is passed through as-is and appended), so don't be afraid to just wire it and see.

For the most part this is a set-and-forget utility. If you see a "VFI wants a batch" error in a video workflow, put this node in the chain and move on with your day.

CategoryInfo-Prompt-Toolkit/ImageInfo

Inputs (1)

NameTypeDefaultDescription
imageIMAGEFrame-by-frame IMAGE inputs to merge into one batch

Outputs (2)

NameTypeDescription
imageIMAGE
frame_countINT