Nodes/ComfyUI 1hewNodes/Image Batch Group
ComfyUI Node

Image Batch Group

Chunk a long batch into overlapping windows without losing the tail

By 1hew·Created about a year ago·Updated 8 days ago· 33
Image Batch Group
  • image
  • image
  • group_total
  • start_index
  • batch_count
  • valid_count
batch_size81
overlap0
last_batch_modebacktrack_last
color1.0

Sometimes one giant image batch is the wrong shape. Your model wants 81-frame chunks, your batch has 300 frames, and you need to split it into windows - with overlap, because video work likes a few shared frames between passes. Image Batch Group is the node that computes those windows for you and hands you the exact indices to pull each one.

Here's the key thing to understand about how it works, because the outputs look confusing at first: it doesn't emit separate image tensors for each group. It returns metadata - a start_index list, a batch_count list, and a valid_count list - plus a group_total count. You then slice each window out of your batch yourself, usually with the pack's Image Batch Range or Image Batch Index using those indices. It's a calculator for grouping, not a magician that rearranges your frames.

The inputs

  • image - the batch to chunk.
  • batch_size - frames per group, default 81. Yes, 81. That's the pack author's go-to for Wan-style video windowing, and it's a fine starting point if you're doing video passes; change it freely for your own model's needs.
  • overlap - how many frames consecutive groups share. 0 for hard cuts, a few frames for anything temporal.
  • last_batch_mode - what happens when the tail doesn't fill a group:
    • drop_incomplete - throw the leftovers away.
    • keep_remaining - keep the short final group as-is.
    • backtrack_last (default) - the last group starts early enough to backfill its full size from the tail frames, so every group is complete.
    • fill_color - pad the short tail with solid color frames to reach full size.
  • color - the fill color for fill_color mode, default "1.0" (white).

Outputs: image (the batch, possibly padded when fill_color is used), group_total, plus the three index lists.

Why the backtrack_last default matters

The whole reason backtrack_last is the default is that a partial tail group is a silent bug in most video pipelines - your last chunk has 30 frames instead of 81 and nothing tells you. Backtracking reuses tail frames to top it up, so downstream nodes always see uniform groups. drop_incomplete is there if you'd rather discard the dregs; just know the default is deliberately the safe one.

Installing it

ComfyUI Manager, search "ComfyUI 1hewNodes", install, restart. Or:

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

Same pack-wide note as its siblings: the repo's requirements.txt is heavy (rembg, ultralytics, transformers, opencv...) because of the pack's detection nodes. This one is pure tensor math - you pay for the bloat regardless.

Gotchas

The metadata-based design is the thing that bites people: if you wire start_index straight into something expecting a tensor, nothing connects. Pair it with Image Batch Range/Image Batch Index and it clicks. Also watch the default batch_size=81 - it's a reasonable Wan-era default, but if you're grouping stills for a grid, set it to what your target actually wants or you'll get mysteriously 81-tall groups.

Category1hewNodes/batch

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
batch_sizeINT811–1024
overlapINT00–1024
last_batch_modeCOMBObacktrack_last4 options: drop_incomplete, keep_remaining, backtrack_last, fill_color
coloroptSTRING1.0

Outputs (5)

NameTypeDescription
imageIMAGE
group_totalINT
start_indexCOMFY_MULTITYPED_V3
batch_countCOMFY_MULTITYPED_V3
valid_countCOMFY_MULTITYPED_V3