Image Batch Split
Split a batch in two — first N frames, or last N frames
- image
- image_1
- image_2
Batches are where ComfyUI gets both powerful and annoying. You've got 40 frames in a single tensor, and half of them need one treatment and half need another - maybe you want to inpaint the first 8 frames of an animation and leave the rest untouched, or isolate the last few frames for a closer look. ComfyUI's built-in tooling for this is thin. Image Batch Split is the direct answer: it cuts one batch into exactly two, at a count you choose, from either end.
How it works
Two parameters do everything:
- take_count - how many frames are in the "taken" part (1–1024, default 8).
- from_start - where the taken part comes from.
The semantics take one mental beat to internalize. With from_start = true, image_1 gets the first take_count frames and image_2 gets the rest. With from_start = false, the split is flipped: image_2 gets the last take_count frames, and image_1 gets everything before them. That "last N goes to image_2" is the bit people swap by accident.
The edge case is handled sensibly: if take_count >= batch_size, one output is the full batch and the other is an empty tensor (same dtype, device, and channel layout - so downstream nodes don't choke on it). The slicing runs in a worker thread, so a big batch won't freeze your UI.
Inputs: image, take_count, from_start. Outputs: image_1, image_2.
Install
This is part of the ComfyUI-1hewNodes pack:
cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes
Restart ComfyUI. Nothing to download, no model weights - pure tensor slicing. The pack wants a current ComfyUI (it's built on the v3 node API), so if the node doesn't show up after install, update ComfyUI.
Where it fits in a workflow
The classic pattern: decode a video to frames → split off a segment → process only that segment → rejoin and encode. This pack gives you the bookends too - Load Video to Image on the front, Save Video by Image on the back. For a "cut a scene out of a video" pipeline, Image Batch Split is the midpoint that decides what gets the expensive treatment and what passes through untouched.
Common issues
- Swapped outputs - remember the last-N-goes-to-
image_2rule withfrom_start = false. It's correct, it's just unintuitive the first time. - Empty output surprises -
take_count >= batch_sizeproduces an empty tensor, not an error. If a node downstream complains about a zero-length batch, that's your cause. - Mask alignment - if you split an image batch, split your mask batch with the pack's
Mask Batch Splitusing the sametake_countandfrom_start, or your image/mask pairs drift apart.
Honestly, this is a "five minutes to understand, use forever" node. Once you've got the direction rule straight, it's the most boring, reliable part of your video-editing graphs.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| take_count | INT | 81–1024 | — |
| from_start | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image_1 | IMAGE | — |
| image_2 | IMAGE | — |