Nodes/ComfyUI-CustomNodePacks/Image Batch Split (C2C)
ComfyUI Node

Image Batch Split (C2C)

Image Batch Split (C2C)

By Code2Collapse·Created 6 months ago·Updated a day ago· 52
Image Batch Split (C2C)
  • images
  • first_part
  • remainder
  • first_count
  • remainder_count
modeindex
index1
ratio0.50

Image Batch Split (C2C) splits one image batch into two at a single cut point - the frame-boundary twin of the pack's Image Batch Slice. Where Slice extracts a range and discards the rest, Split hands you both pieces: everything before the cut and everything from the cut on. That's the operation you reach for when you want to run different treatment on two halves of a video, or hold back the first N frames as a reference while processing the rest.

It's part of the C2C Helpers in ComfyUI-CustomNodePacks, the ~72-node umbrella pack from Code2Collapse (Likhith-24, active on r/comfyui).

How it works

Feed it images and pick how the cut is defined with the mode dropdown:

  • index mode - cut at an absolute frame number. index=1 (the default) puts the first frame alone in first_part and everything else in remainder. This is the mode for "first frame = clean reference, rest = to be processed."
  • ratio mode - cut at a fraction of the batch. ratio=0.5 splits a 60-frame batch into two 30-frame halves; ratio=0.25 takes the first quarter. Handy when you know you want "the first half" without counting frames.

The cut index is clamped to the batch size, so index=9999 on a 60-frame batch just puts everything in the first part rather than erroring. Outputs are first_part and remainder (both IMAGE), plus first_count and remainder_count (both INT) so you can wire the actual sizes downstream without trusting your mental math.

The inputs and outputs that matter

  • images - the only required input.
  • mode - index (by frame number) or ratio (by fraction). Decide which is more natural for your use.
  • index / ratio - the cut position, used by the corresponding mode.
  • first_part / remainder - the two output batches. Note the asymmetry: first_part is before the cut, remainder is the cut onward.
  • first_count / remainder_count - frame counts for both, so a downstream node knows what it got.

Installing it

Ships inside ComfyUI-CustomNodePacks; no standalone repo. ComfyUI Manager → search "CustomNodePacks", or:

cd ComfyUI/custom_nodes
git clone https://github.com/Code2Collapse/ComfyUI-CustomNodePacks.git

Pure tensor slicing, no extra dependencies or models. The pack overall needs opencv-python>=4.7.0 and scipy>=1.10.0 for its heavier nodes - install just those if missing (skip the full requirements.txt; it can clobber ComfyUI's torch). Restart ComfyUI.

Common issues

  • The two halves don't add up to the original - they should, since it's a clean split, but if you're splitting a batch that a previous node already decimated, the count reflects the current batch. Check first_count + remainder_count against what you think you fed in.
  • ratio=0.5 didn't land exactly in the middle - with an odd frame count it rounds to the nearest integer cut, so 61 frames → 31/30. Fine for most uses; if you need a precise frame, use index mode.
  • You need more than two pieces - chain two Splits, or reach for the pack's Image Batch Slice for an arbitrary range. Split is deliberately a binary operation.

The blunt take: it's a boring, correct utility. You won't think about it until the day you need "the first frame separate from the rest" and suddenly it's the exact node you were missing.

CategoryC2C/Helpers

Inputs (4)

NameTypeDefaultDescription
imagesIMAGE
modeCOMBOindex2 options: index, ratio
indexINT10–100000
ratioFLOAT0.500–1

Outputs (4)

NameTypeDescription
first_partIMAGE
remainderIMAGE
first_countINT
remainder_countINT