What is Batch?

A Batch is a way to process multiple images together, at the same time. Where a List "processes items one at a time, in order," a Batch sends several images through at once in a single run.

Here's how Queue, List, and Batch relate:

  • Queue
    • Runs the same workflow repeatedly, in order, from the outside
  • List
    • Processes multiple inputs one at a time, in order (sequential processing)
  • Batch
    • Processes multiple images as one bundle (parallel processing)

Video is Batch

A video is made up of a sequence of numbered images, so ComfyUI treats video = a Batch of IMAGE.

That means regular Batch nodes work on videos as they are, and the other way around, video nodes feel almost the same as ordinary Batch operations. You don't need to think of video and Batch as separate things.


Images in Batch must be the same size

Images entering a Batch must all be the same size. If the width or height doesn't match, the later images are automatically cropped to match the first one.

diff_list_batch.json

Top: List Bottom: Batch Because the shapes have to match, the later images get cropped in the Batch.


Load of Parallel Processing (Note on OOM)

A Batch processes several images at the same time, so it needs that much more memory. Try feeding a 1-minute video straight into image2image, and you'll run out of VRAM and hit OOM (Out Of Memory) in no time.

In cases like this, it's best to convert the Batch → List and process the frames one at a time.


Required Custom Nodes

The basics are covered by core nodes, but they fall a bit short once you start working with video.


Creating a Batch

Batch Images Node

Groups multiple IMAGEs into a Batch.

batch_images.json
  • A new slot appears each time you connect one, so you can combine as many images as you like.

Load Image Batch From Dir (Inspire) / Load Images (Path) Node

Groups images in a folder into a Batch.

load_image_batch_from_dir_load_image_path.json
  • The Inspire node can sort
  • The VHS node has extra options, such as "output every N images"

Operating Batch

Reverse Image Batch Node

Reverses the order of the Batch. Useful for things like playing a video backwards.

reverse_image_batch.json

RepeatImageBatch Node

Repeats the entire Batch a specified number of times.

ImageBatchRepeatInterleaving Node

Repeats each frame a specified number of times.

repeatimagebatch_imagebatchrepeatinterleaving.json

Top: RepeatImageBatch Bottom: ImageBatchRepeatInterleaving


Extracting from Batch

ImageFromBatch Node

Picks out the image at any position in the Batch.

imagefrombatch.json
  • batch_index: Position to extract (starts from 0)
  • length: Number of images in Batch

Get Image or Mask Range From Batch Node

Extracts a range of images (or masks) at once.

Select Every Nth Image Node (Video Helper Suite)

Takes every Nth frame.

select_every_nth_image.json
  • select_every_nth: How often to take a frame
  • skip_first_images: How many images to skip at the start

Conversion Batch ↔ List

If you want to process a video or Batch one image at a time after loading it, convert it to a List.

Image Batch to Image List Node

image_batch_to_image_list.json

There's also a node that goes the other way, combining a List into a Batch.

  • Image List to Image Batch Node