Nodes/ComfyUI_Fill-Example-Nodes/Fill Example: Image Batcher
ComfyUI Node

Fill Example: Image Batcher

The Example Node That's Secretly a Real Tensor Pattern

By filliptm·Created about a year ago·Updated 5 months ago· 6
Fill Example: Image Batcher
  • image
  • IMAGE
  • STRING
batch_size1

Fill Example: Image Batcher is the one node in this pack that's closer to a real tool than a toy. Take one image, tell it how many copies you want, and it hands you a batch of that many identical images plus a text description of what the input actually looked like. In a vacuum that sounds useless. In ComfyUI, "make an image into a batch of N identical images" is a genuinely recurring need - it's exactly what you do when you want a sampler to chew through several copies of the same picture in a single pass, or when a downstream node expects a batch dimension and you've only got one image.

The catch, which the name telegraphs honestly: every copy is identical. It's repeat, not "load me N different images." If you need a batch of different images, this isn't the node - you'd be combining separate images into a list. This one's for multiplying one image.

How it works

ComfyUI images are float tensors of shape (B, H, W, C) - batch, height, width, channels - with values in the 0–1 range. The whole node is one line of PyTorch:

batched_image = image.repeat(batch_size, 1, 1, 1)

The repeat call duplicates the tensor batch_size times along the batch axis (the first dimension) and leaves height, width, and channels alone. One (1, 512, 512, 3) image in, one (8, 512, 512, 3) batch out. Wire that into a KSampler and you're sampling the same image eight times in one run. The second output is just a string like Original shape: torch.Size([1, 512, 512, 3]) - a diagnostic so you can see what the node received. That's the whole teaching point: it's a worked example of reading and reshaping image tensors, and the shape string exists so beginners can watch it happen.

Inputs and outputs

Only two things to set:

  • image (IMAGE) - the image to duplicate. This is the one input worth worrying about; it has to be a real image tensor, so it comes from a Load Image, a VAE Decode, or another node's IMAGE output.
  • batch_size (INT, default 1, min 1, max 64) - how many copies to stack. Default 1 means "just pass it through."

Outputs are IMAGE (the batch) and STRING (the shape description). Wire the IMAGE where you need a batch; the STRING is for looking at, not for anything structural.

Install

No dependencies, no model downloads - the pack is pure Python plus a bit of frontend JS.

  • ComfyUI Manager → Install Custom Nodes → search "ComfyUI_Fill-Example-Nodes" → install → restart.
  • Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Example-Nodes

Then restart ComfyUI.

Common issues

The one real failure mode here is your VRAM, and it's worth respecting. Batching means memory multiplies: a 512×512 batch of 64 is 64 images' worth of tensor held at once, and if that batch feeds a sampler, the sampler holds all of it for the whole pass. Keep batch_size modest unless you know the downstream node can take it - this is a demo, not a reason to blow up a 8GB card.

Otherwise there's not much to break. The STRING output is easy to misread as an error message - it's not, it's just shape info. And if you wired it up expecting N different images, remember the mechanism: repeat duplicates the same tensor, so every frame in the output is identical. That's the intended behavior, and honestly the most useful thing this node teaches you - once you've seen repeat(batch_size, 1, 1, 1) do its thing, tensor batch semantics stop being abstract and you'll recognize the same pattern in half the utility packs you install.

CategoryFill-Example-Nodes

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
batch_sizeINT11–64

Outputs (2)

NameTypeDescription
IMAGEIMAGE
STRINGSTRING