Nodes/Akatz Custom Nodes/Split Image Batch | Akatz
ComfyUI Node

Split Image Batch | Akatz

Cut an image batch in two and keep the side you need

By akatz-ai·Created 2 years ago·Updated 9 months ago· 32
Split Image Batch | Akatz
  • image_batch
  • IMAGE
split_index1
split_batch_index0

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, default 1, min 1) - where the cut happens. With the default of 1, the first partition is a single frame.
  • split_batch_index (INT, default 0, range 0..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_index out of range raises a ValueError instead 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_index is the first frame of the second partition. 3 gives you frames 0,1,2 on one side and 3... on the other.
Category💜Akatz Nodes/Utils

Inputs (3)

NameTypeDefaultDescription
image_batchIMAGE
split_indexINT1
split_batch_indexINT00–1

Outputs (1)

NameTypeDescription
IMAGEIMAGE