Nodes/ComfyUI-WJNodes/Select Batch v2
ComfyUI Node

Select Batch v2

Pick, repeat, and reorder frames in a batch by index

By 807502278·Created 2 years ago·Updated 11 months ago· 20
Select Batch v2
  • images
  • masks
  • select_img
  • exclude_img
  • select_mask
  • exclude_mask
  • img_order
  • mask_order
indexes1,2,
loop1
loop_methodtile
limitClamp

If its sibling SelectBatch_paragraph is "give me a range," Select_Batch_v2 is "give me exactly these frames, in this order, possibly more than once." It's the pick-and-remix version of batch selection: type a list of indices, and it hands you back precisely that sequence - repeats, reorders, and all. This one's from the same ComfyUI-WJNodes pack, a personal utility collection from GitHub user 807502278 rather than anything with a marketing page behind it - go in expecting a plain node list for a README, not a wiki.

How it works

indexes is a plain string of comma-separated frame numbers, 0-indexed. Leave it empty and you get everything - worth remembering, because "empty" reads like "nothing" the first time you see it and it means the opposite. It also parses Chinese full-width commas, a small tell that this pack was built by and for a Chinese-speaking ComfyUI crowd first and translated to English second.

loop and loop_method control repetition. loop is how many times to duplicate the selection; loop_method decides how. tile repeats the whole sequence back-to-back - select 1,2,3 with loop 2 and you get 1,2,3,1,2,3. repeat instead holds each frame in place and duplicates it individually - the same selection becomes 1,1,2,2,3,3. Same total frame count either way, completely different result: tile for looping a clip end-to-end, repeat for a stutter/hold effect or cheaply slowing footage down without an actual interpolation step.

limit decides what happens to an index that falls outside the batch's real size - say you ask for frame 20 out of an 8-frame batch. Clamp pins it to the last valid frame, Loop wraps it around (frame 20 on an 8-frame batch becomes frame 4), and ignore disregards it rather than forcing it into range. As with the sibling node, images and masks are handled independently and can have different batch counts.

The inputs and outputs that matter

  • indexes (string, default "1,2,") - the frames you want, comma-separated, empty means all.
  • loop (int, default 1) - how many times to duplicate the selection.
  • loop_method - tile (repeat the sequence) or repeat (hold each frame).
  • limit - Clamp, Loop, or ignore for out-of-range indices.
  • select_img / select_mask - your picks, in the order and repetition you asked for.
  • exclude_img / exclude_mask - the frames you didn't select (these skip the loop/limit processing entirely).
  • img_order / mask_order - the original batch index of every frame you selected, in output order. Wire this to a debug/preview output any time you use loop; it's the fastest way to confirm what actually got selected before you go hunting for the bug elsewhere.

How to install it

Same as the rest of the pack. Via ComfyUI Manager: search "ComfyUI-WJNodes," install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-WJNodes

restart ComfyUI. No models to download for this node - it's pure indexing logic, nothing hits disk.

Common issues & troubleshooting

Comma parsing is the first place people trip: if you paste indexes from somewhere that used a different separator - spaces, semicolons, newlines - it likely won't parse the way you expect. Stick to plain commas.

If output looks scrambled after using loop, check img_order/mask_order first rather than assuming the node is broken - it's the only way to actually see what got selected and in what sequence, and nine times out of ten the issue is your indexes string, not the node's logic.

And the blank-means-everything behavior is worth internalizing early: if you meant to select nothing (say, to test the exclude_img path in isolation), an empty indexes field won't get you there - you'll need to route around this node instead.

CategoryWJNode/ImageEdit/Batch

Inputs (6)

NameTypeDefaultDescription
indexesSTRING1,2,
loopINT11–2048
loop_methodCOMBOtile2 options: tile, repeat
limitCOMBOClamp3 options: Clamp, Loop, ignore
imagesoptIMAGE
masksoptMASK

Outputs (6)

NameTypeDescription
select_imgIMAGE
exclude_imgIMAGE
select_maskMASK
exclude_maskMASK
img_orderLIST
mask_orderLIST