Nodes/ComfyUI Inspire Pack/Change Image Batch Size (Inspire)
ComfyUI Node Runs on cloud

Change Image Batch Size (Inspire)

Pad or trim an image batch to an exact count

By ltdrdata·Created 3 years ago·Updated 9 months ago· 805
Change Image Batch Size (Inspire)
  • image
  • IMAGE
batch_size1
mode

This is a small, boring, occasionally-a-lifesaver node. It forces an image batch to be exactly N frames - padding it if it's too short, trimming it if it's too long. Where you actually hit this is video and batch pipelines that demand matching counts: a node expects 16 frames and you handed it 12, or two batches need to line up before you can combine them. Change Image Batch Size makes the numbers agree.

Nobody puts this on a workflow for fun. It's the kind of node you drop in when something downstream throws a size-mismatch error and you just need the batch to be the right length. And for that, it's exactly right.

How it works

You set a target batch_size and it reshapes the incoming batch to hit it. The behavior in simple mode is spelled out in the pack's docs: if the target is larger than the input batch, the last frame is duplicated to fill the gap; if it's smaller, the batch is simply cropped to length. So growing a batch repeats the final image, and shrinking it drops the tail. No interpolation, no resampling - it's a straightforward pad-or-truncate.

The inputs and outputs that matter

  • image - the batched IMAGE to resize.
  • batch_size (default 1, up to 4096) - the exact frame count you want out. This is the whole control.
  • mode - currently simple, the pad-with-last-frame / crop behavior described above.

Output is a single IMAGE batch at your target count.

Installing it

Part of the Inspire Pack by Dr.Lt.Data, author of ComfyUI Manager and the Impact Pack - trustworthy, well-maintained tooling. Via ComfyUI Manager: search ComfyUI Inspire Pack, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Inspire-Pack

then restart. No dependencies or downloads. Its Change Latent Batch Size (Inspire) sibling does the same job for LATENT batches before decoding.

Common issues

My padded frames are all identical at the end. That's simple mode working as designed - growing a batch duplicates the last frame, it doesn't invent new content. If you needed smooth new frames (for video), this isn't the tool; you'd want a frame-interpolation node instead. Change Image Batch Size is for making counts match, not for generating motion.

Shrinking dropped the wrong images. It crops from the end, keeping the first N. If you needed a different slice, reorder or select upstream before resizing.

Should I resize before or after decoding? If you're working in latent space, use Change Latent Batch Size before VAE Decode - it's cheaper than moving whole images around. Use this image version when the mismatch shows up after decode.

Nodes won't load after install. Check the terminal log - usually a version mismatch. Update Inspire Pack and Impact Pack together and restart.

CategoryInspirePack/Util

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
batch_sizeINT11–4096
modeCOMBO1 options: simple

Outputs (1)

NameTypeDescription
IMAGEIMAGE