Split Image Batch | Akatz
Cut an image batch in two and keep the side you need
- image_batch
- IMAGE
Image batches love to pack multiple things into one tensor: the first 12 frames of one clip and the next 12 of another, a base image followed by a stack of variations, a generated sequence plus a reference frame tacked on the end. When you need to treat the two halves differently - different denoise, different upscale, one half into a crossfade - you have to split first. AK_SplitImageBatch cuts the batch at an index and hands you one of the two partitions.
Why you'd reach for it
It's the plumbing for any workflow where part of a batch means something different from the rest. The pack's own AK_FadeBetweenBatches takes two separate batches and crossfades them, so a splitter is the natural upstream. You'll also use it to peel a "pre + post" sequence apart, isolate the first N frames of an animation for special handling, or separate a batch that a sampler produced with mixed conditions.
How it works
The node slices the tensor like a list: image_batch[:split_index] is partition one, image_batch[split_index:] is partition two. Then split_batch_index picks which one you get - 0 for the first, 1 for the second. It validates that split_index falls strictly between 1 and batch_size - 1, so you can't split at the very ends and hand back an empty tensor.
Inputs and outputs
- image_batch (
IMAGE) - the batch to split. - split_index (
INT, default1, min1) - where the cut happens. With the default of1, the first partition is a single frame. - split_batch_index (
INT, default0, range0..1) - which half you get back. - IMAGE output - one partition, per
split_batch_index.
Because it only returns one side, you'll often see two instances of this node (one per split_batch_index) when a workflow needs both halves at once.
Installing the pack
Part of Akatz Custom Nodes (akatz-ai/ComfyUI-AKatz-Nodes). ComfyUI Manager: search "Akatz" and install, or clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/akatz-ai/ComfyUI-AKatz-Nodes
Restart ComfyUI; it's under 💜Akatz Nodes. Torch only, already in ComfyUI; the pack's other requirements.txt entries (numpy, opencv-python, pydub) belong to its image/audio nodes. No models to download. The README is a stub that routes you to the author's Notion docs and a custom GPT.
Gotchas
split_indexout of range raises aValueErrorinstead of silently giving you an empty batch - that's the node being honest, so read the message rather than fighting it.- It's a plain cut, no overlap, no blending. If the boundary itself needs to be smooth, run the two halves through a crossfade node rather than expecting the split to soften anything.
- Off-by-one gotcha:
split_indexis the first frame of the second partition.3gives you frames0,1,2on one side and3...on the other.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image_batch | IMAGE | — | |
| split_index | INT | 1 | — |
| split_batch_index | INT | 00–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |