Nodes/ComfyUI 1hewNodes/Image Batch Uniform
ComfyUI Node

Image Batch Uniform

Pull a representative film strip out of any batch

By 1hew·Created about a year ago·Updated 8 days ago· 33
Image Batch Uniform
  • image
  • image
num_frame4

Video work in ComfyUI generates a lot of frames, and most of the time you don't want to look at all of them. Image Batch Uniform samples your batch down to a set number of evenly spaced frames - a contact sheet, essentially - while making sure you always keep the first and last. That's the whole trick, and it's a genuinely useful one.

It's from ComfyUI 1hewNodes, the utility pack by solo dev 1hew (bilingual README, active v3.x development, no real community footprint - the docs are the ground truth). In a pack full of batch-slicing utilities, this is the "evenly spaced" one.

How it works

Give it a batch of, say, 300 frames and num_frame = 5, and it returns frames at evenly spaced positions across the range - including index 0 and the last frame, which is what makes it good for previews and summaries rather than just "some frames." The spacing math handles the awkward cases too: num_frame = 1 gives the first frame, num_frame = 2 gives first and last, and num_frame = 0 (or anything ≥ the batch size) just returns everything unchanged. Frames come back in original order, which matters when you're building a film strip.

The implementation processes the batch in chunks so huge frame counts don't blow up memory in one allocation - a small sign the author actually runs this on real video.

The inputs that matter

  • image - your IMAGE batch (usually decoded video frames).
  • num_frame - how many frames to keep. Default 4; 0 = return all.

Output is a single image batch of the sampled frames. Common downstream: a preview/contact sheet node, feeding a fixed N frames to an edit or analysis model that can't take 300, or making thumbnails. If you need a range of frames with a step instead (e.g. "every 10th frame from 40 to 200"), that's the sibling Image Batch Range node - this one is specifically for "I want N evenly spaced."

Installing it

ComfyUI Manager → search "1hew" / "ComfyUI 1hewNodes" → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes

Heavy requirements list (opencv, scikit-image, scikit-learn, plus ultralytics/rembg/transformers for the pack's detection nodes) makes first install slow. No models needed for this node. Built on the modern ComfyUI node API, so keep ComfyUI updated.

Gotchas

  • "Not all frames shown" is not a bug - if you ask for 5 frames from a 4-frame batch, you get all 4. num_frame is a ceiling, not a demand.
  • Indices can't repeat - the sampler avoids duplicate picks when spacing doesn't divide evenly, so you might get a slightly irregular gap near the end. Not worth fighting; it's rare and harmless.
  • Empty batches return an empty batch rather than crashing, so check downstream assumptions if your input can be empty.
Category1hewNodes/batch

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
num_frameINT40–8192

Outputs (1)

NameTypeDescription
imageIMAGE