π§ Image Expand Batch
Pad an image batch up to a target frame count
- image
- IMAGE
Video and batch workflows love to hand you a mismatch: one part of your graph produces N frames, the next part expects exactly M. Image Expand Batch grows an image batch up to a target count instead of you writing custom padding logic or manually duplicating frames to make the numbers line up.
This comes up constantly around video models and AnimateDiff-style pipelines, where a lot of nodes are picky about exact frame counts - a motion module trained on 16-frame windows, a batch of conditioning entries that has to match the image batch one-to-one, an interpolation step that needs a specific input length to hit a target output length cleanly. Rather than reason through the padding math yourself every time, this node takes "here's what I have, here's what I need" and handles the rest.
How it works
size (default 16) is the target batch count. method picks how the new frames get filled in:
expand- spreads new frames across the existing sequence rather than piling them at one end, closer to interpolating the sequence out to a longer length.repeat all- loops the whole existing batch to fill up to the target size.repeat first- pads the front by repeating the very first frame.repeat last- pads the tail by repeating the last frame, the common choice for "hold on the final frame" style padding in video-continuation workflows.
Inputs and outputs
image, size (INT, minimum 1, default 16), method (enum: expand / repeat all / repeat first / repeat last). Output: IMAGE.
Installing it
Via ComfyUI Manager, search "ComfyUI Essentials". Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/cubiq/ComfyUI_essentials
Restart. Maintenance-only pack since April 2025.
Common issues & troubleshooting
Batch didn't shrink when you set size smaller than your current count. This node's job is filling up to a target - it's not built to trim a batch down, so don't count on it for that direction. Use a batch-slicing or list-trimming node instead if you need to shrink.
Wrong end of the sequence got padded. repeat first and repeat last matter more than they look - pick whichever matches the end of your sequence that's actually worth holding on. For most video-continuation workflows that's the last frame, so repeat last is usually the one you want, not the default-feeling repeat first.
expand produces something that looks like it's just repeating anyway. With a small gap between your current count and the target size, expand's spread-across-the-sequence behavior and simple repetition can look similar. The difference shows up more clearly the bigger the gap between your current batch size and the target.
Padding an image batch that has a paired mask or latent batch. If something else in your graph needs to stay aligned frame-for-frame with this batch, use this pack's Mask Expand Batch (or the equivalent for whatever else you're carrying) with the same size and method - mismatched padding choices between paired batches is the single most common way this class of node bites people.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | β | |
| size | INT | 16 | β |
| method | COMBO | 4 options: expand, repeat all, repeat first, repeat last |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | β |