AD_ImageExpandBatch
Pad an image batch out to a target frame count
- image
- IMAGE
Video workflows are picky about frame counts. AnimateDiff wants its 16-frame context window filled; LTX wants a frame count that fits its grid; whatever downstream node you're feeding might just flat-out error if your image batch is shorter than what it expects. AD_ImageExpandBatch is the fix: it takes whatever batch you've got and pads it out to a target size, choosing how the extra frames get filled in.
Worth flagging up front - this node lives in the pack's own "backup" menu category, which reads as the author's way of saying it's not the primary path anymore even though it still works. If a newer Apt_Preset node covers the same ground and isn't tucked in backup, prefer that one; if not, this one's still a perfectly functional batch-padding utility.
How it works
It's straightforward count-matching, not generative interpolation (that's what AD_FILM_VFI is for). You give it a target size and a method, and it duplicates existing frames according to that method until the batch hits the target length.
The inputs and outputs that matter
image(IMAGE) - the batch you're padding.size(default 16, min 1) - the target frame count you want the batch expanded to. Default 16 lines up with AnimateDiff's native context window, which is presumably why it's the default.method- how the extra frames get generated:expand- spreads the padding across the batch rather than dumping it all at one end.repeat all- loops the whole existing batch to fill the target length.repeat first- pads by repeating the first frame.repeat last- pads by repeating the last frame.
Output is a single IMAGE batch at the target size.
How to install it
Through ComfyUI Manager, search "ComfyUI-Apt_Preset" and install. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
Then run install.bat (Windows, double-click) or pip install -r requirements.txt from inside the folder (Linux/Mac) per the pack's README, and restart ComfyUI. No model files or heavy dependencies here - this node just duplicates tensors, it doesn't load anything.
Common issues & troubleshooting
Padding looks static or repetitive. That's expected with repeat first or repeat last - you're literally freezing on one frame for the padded portion, which is fine for a leading/trailing hold but will read as a stutter if the padding is a large fraction of the total batch. If you need actual motion in the padded region instead of frozen frames, this isn't the tool - reach for interpolation instead.
size smaller than your input batch. This node is built to expand, not trim - feeding it a size smaller than your current frame count is outside what it's designed to do; use a batch-slicing node (like AD_frame_replace in extract mode) if you need to shorten a sequence instead.
Downstream node still complains about frame count. Make sure the size you picked actually matches what the downstream node needs - AnimateDiff context windows, LTX's frame-count grid, and a plain video-combine node can all want different numbers, so match size to whichever one you're feeding next, not just to a round number.
You're not sure which padding method to pick. repeat first/repeat last are the safe default for holding on an opening or closing frame; repeat all is better when your batch is meant to loop; expand is the one to try if the other two leave an obvious seam where the padding starts.
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 | ā |