Nodes/Multi-image-loader/Image Batch Builder
ComfyUI Node

Image Batch Builder

Grow a Qwen reference batch one image at a time, with no fixed slot count

By balarooty·Created 5 months ago·Updated 5 months ago· 0
Image Batch Builder
  • image_new
  • image_batch
  • image_batch
  • batch_size

Most batch loaders make you commit to a slot count up front. The ImageBatchBuilder node is the one that grows a batch progressively - you chain a few of these together and end up with a reference batch of any size, no "2 to 8 images, pick your slot" contract. If you're assembling a set of reference images for a Qwen-Image-Edit story workflow, this is the glue.

What it does

The inputs are the whole thing: image_new (required, an IMAGE) and image_batch (optional, an IMAGE). Leave image_batch unconnected and the node starts a fresh batch with just image_new. Wire a batch in and it appends image_new onto the end, concatenating along the batch dimension. It hands back two outputs: image_batch (the grown stack) and batch_size, an INT telling you how many frames you've piled up so far.

That batch_size output is more useful than it looks. It's your sanity check before you wire the batch into something that indexes into it - like this pack's QwenMultiRefEncoder, which pulls two frames out by index. Know your count before you let anything pick by number.

The chain is exactly what the README draws:

LoadImage → ImageBatchBuilder → LoadImage → ImageBatchBuilder → ...

Each builder's image_batch output feeds the next one's image_batch input. End the chain wherever you want.

Why you'd bother

Because it's the pack's "grow a batch from anything" node. The sibling Multi Image Loader (2–8) only reads images from disk and only has eight slots. This one takes any IMAGE tensor - a generated frame, a video frame, an upscale - so it composes with the rest of your graph, not just the file loader. In a Qwen workflow you're building a library of references (your character, your object, your scene) and then asking the editor to combine them: Qwen-Image-Edit's multi-image mode is what lets you say "put the hat from image2 onto the person in image1." This node is the quiet infrastructure that assembles image1, image2, image3... in the first place.

A trap to know about

An IMAGE tensor in ComfyUI is rectangular - every frame in the batch must share the same height and width, because they live in one tensor. This node handles that for you by silently resizing image_new to match the existing batch's dimensions with a LANCZOS downscale. Silently is the operative word. Feed it a 1024×1024 batch and a 768×512 image and you get a stretched 768×512, not a letterboxed one. Feed same-size or same-aspect sources and you'll never think about it; mix wildly different aspect ratios and your references come out squished and you won't know why.

Second, if image_new is itself a multi-frame batch, you append all of its frames at once - batch_size jumps by however many were in that input. Not a bug, just surprising if you expected one frame per node.

Install

It ships in the balarooty/Multi-image-loader pack, which installs like any custom node. Easiest is ComfyUI Manager - search "Multi-image-loader" in the Install Custom Nodes tab. Or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/balarooty/Multi-image-loader

Then restart ComfyUI. No extra pip dependencies, no model files to download - the code only uses torch, numpy and PIL, all of which ship with ComfyUI. The models it's plumbing for (your Qwen-Image-Edit checkpoint, your input images) load through ComfyUI's normal loaders.

One honest caveat: this pack is tiny and fresh - a single-commit utility with essentially no community footprint yet. It's simple enough to eyeball, but remember custom nodes run unsandboxed Python on your machine, so the usual "only install packs you've looked at" rule applies. For this one, looking at it takes about two minutes.

Categoryimage/multi

Inputs (2)

NameTypeDefaultDescription
image_newIMAGE
image_batchoptIMAGE

Outputs (2)

NameTypeDescription
image_batchIMAGE
batch_sizeINT