Nodes/ComfyUI 1hewNodes/Image Batch Split
ComfyUI Node

Image Batch Split

Split a batch in two — first N frames, or last N frames

By 1hew·Created about a year ago·Updated 7 days ago· 33
Image Batch Split
  • image
  • image_1
  • image_2
take_count8
from_startfalse

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_2 rule with from_start = false. It's correct, it's just unintuitive the first time.
  • Empty output surprises - take_count >= batch_size produces 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 Split using the same take_count and from_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.

Category1hewNodes/batch

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
take_countINT81–1024
from_startBOOLEANfalse

Outputs (2)

NameTypeDescription
image_1IMAGE
image_2IMAGE