Split Image Batch to List of Image Batches
Turn a wall of frames into pairs Claude can actually chew on
- images
- sub_batches
- start_index
- end_index
- sub_batch_count
This is the quiet workhorse of the pack, and honestly the one you'll reach for even if you never touch the Claude node. Split Image Batch to List of Image Batches takes one IMAGE batch and hands you a list of smaller batches. That one word - list - is doing all the work: in ComfyUI, a node that outputs a list makes the scheduler call everything downstream once per item. So feed it a 240-frame video and you get, say, 120 calls of 2 frames each, instead of one call with 240 frames stuffed in.
Why care? Because this pack's headline node, ClaudeCliVisionText, runs claude -p once per call. Feed it a giant batch with send_all_frames on and you're asking Claude to think about hundreds of images in a single prompt - slow, expensive, and worse output. Feed it pairs and you get cross-frame reasoning ("do these two frames show the same person?") at a fraction of the cost. The splitter is the piece that makes that workflow sane.
How it works
Three knobs, and only one of them is confusing:
sub_batch_size(default 2) - frames per sub-batch. That's your pair.stride(default 0) - how many frames to advance between sub-batches.0means "same as sub-batch size," i.e. a clean non-overlapping partition.1gives a sliding window. Any other value is a custom stride. The node even prints a hint under it: "stride 0: stride = sub-batch size."last_sub_batch_policy(defaultkeep_remainder) - what to do with the ragged tail.keep_remainderreturns whatever's left as a short final batch;drop_remainderthrows it away;pad_with_lastpads the tail by repeating the final frame.
For a batch of 8 with size 3 and keep_remainder, you get [0:3], [3:6], [6:8] - with each sub-batch's original start and end indices reported alongside.
Inputs and outputs
The inputs are the three above plus images. The outputs are the part people miss:
sub_batches- the list of IMAGE sub-batches (this is the one you wire into Claude, or anything that takes an IMAGE).start_index/end_index- parallel lists of INTs giving each sub-batch's original-batch position, for labeling or tracking.sub_batch_count- a single INT, handy for reporting.
Installing it
Same as the rest of the pack - and note the nice part: this node is pure torch slicing. It does not need Claude Code installed, no claude login, nothing. Clone it or grab it from ComfyUI Manager (search "Claude CLI (Vision+Text)"):
cd <ComfyUI>/custom_nodes
git clone https://github.com/RandyHaylor/comfyui-claude-cli-vision-text-node.git
Restart, hard-refresh the browser tab (Ctrl+Shift+R). No pip install - just numpy, torch, and Pillow, which ComfyUI already has.
The traps
keep_remaindergives you a ragged last batch. Claude handles it fine, but if you're doing anything that expects uniform sizes, reach forpad_with_last- and know that it repeats the final frame, which is a duplicate image, not a new one.drop_remaindersilently eats your tail frames. If you need full coverage of the video, that's how you quietly lose the last N seconds.- With stride smaller than the batch size, frames overlap between sub-batches and get analyzed more than once. Sometimes that's the point (sliding windows); if you're counting tokens per frame, it's a leak.
- The node expects a proper
(N,H,W,C)tensor and will tell you off in plain English if you hand it something flattened.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| sub_batch_size | INT | 21–1024 | — |
| stride | INT | 00–1024 | 0 = non-overlapping (same as sub_batch_size). 1 = sliding window. Any other value = custom stride. |
| last_sub_batch_policy | COMBO | keep_remainder | 3 options: keep_remainder, drop_remainder, pad_with_last |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| sub_batches | IMAGE | — |
| start_index | INT | — |
| end_index | INT | — |
| sub_batch_count | INT | — |