TS Smart Batch
Batch two images without breaking when one isn't there
- images
- image
Here's a ComfyUI annoyance that quietly eats an afternoon: the core Batch Images node has two required inputs. Mute or bypass one side - as you constantly do when toggling a first-frame / last-frame pair for a video model - and the whole graph fails before it even runs, because "one of two required inputs is missing" is an error, not a request. TS Smart Batch is the fix: it batches images where every slot is optional, so a missing or bypassed source is simply skipped instead of killing the run.
How it works
The inputs grow. Fill the last slot and the next one appears, up to 32 - no limit you'll realistically hit. Every slot is optional, so connect one and it passes through untouched; connect two and you get a batch of two; bypass one and the other still flows. Nothing connected at all is the only error, and the node says so plainly instead of handing you a blank frame (which is what most naive implementations do).
The behavior matches core's Batch Images exactly where it matters, so swapping one for the other won't change your results: a missing alpha channel is padded with 1.0, and a differently-sized image is resized to match the first one that actually arrived. Batches concatenate - 3 frames plus 2 frames give 5 - and frames come out in slot order (image0, image1, image2…), whatever gaps you left.
What to wire it into
The canonical use case is FLF (first/last frame) video models: you have a first frame and a last frame, and you switch one on or off without rewiring. With TS Smart Batch you feed both, flip a bypass, and the model just gets whichever frames exist. It's also the general answer to "one node should emit a batch of however many sources happen to be switched on."
The input is a single growing images socket (a COMFY_AUTOGROW_V3 type - that's the mechanism behind the self-adding slots) and the output is one image: the batch of whatever actually arrived.
Install
No dependencies, no models, no files - it's a pure-Python convenience node inside comfyui-timesaver.
cd ComfyUI/custom_nodes
git clone https://github.com/AlexYez/comfyui-timesaver
cd comfyui-timesaver
python -m pip install -r requirements.txt
Restart, search "TS Smart Batch".
Common issues
- "The output is a batch of the wrong thing." If you connected two images of different sizes, the second is resized to match the first that arrived - same as core. Wire a resize node upstream if you need exact control.
- "It errors anyway." Only when nothing is connected - that's the one genuine error, and the message tells you so directly.
- "I expected 4 frames and got 2." Gaps are skipped by design:
image0andimage2connected gives you a batch of 2 in slot order, not a blank placeholder for the gap.
The honest scope: this is a two-dollar plumbing fix, not a feature you'll show off. But it's the difference between a first/last-frame workflow you can toggle with one bypass and one that needs rewiring every time - which is exactly the kind of busywork the pack's whole premise is about removing.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| imagesopt | COMFY_AUTOGROW_V3 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | Batch of whatever actually arrived: both images stacked, or the single one that was connected. |