Nodes/ComfyUI-WJNodes/Select Images Batch
ComfyUI Node

Select Images Batch

Pick exact frames out of a batch, and get the rejects too

By 807502278·Created 2 years ago·Updated 11 months ago· 20
Select Images Batch
  • images
  • masks
  • select_img
  • exclude_img
  • select_mask
  • exclude_mask
indexes1,2,

Say you've generated a batch of 12 images and only 4 of them are worth keeping. Select Images Batch is the node for picking exactly which ones, by number, without touching Python or writing a filter - and it hands you back both halves of the split, the ones you picked and the ones you didn't, from a single node.

The inputs and outputs that matter

The whole interface is one field: indexes, a multiline string where you type which batch positions you want, like 1,3,5,8. Two things to know because they'll bite you if you assume otherwise: counting starts at 1, not 0 - the first image in the batch is index 1 - and the field understands Chinese-style commas too, so a pasted list with full-width punctuation still works. Anything out of range gets ignored rather than erroring; if every index you list is out of range, the node returns nothing instead of guessing.

Feed it images, masks, or both - they're both optional, and the node adapts to what you give it. Only images in, and the mask outputs get built from your images' alpha channel (or a plain white mask at the right size if there's no alpha at all). Only masks in, and it's the mirror: mask outputs come back directly, and image outputs are the masks rendered as grayscale.

The real feature is four outputs, not two: select_img and select_mask are the batch items at the indexes you listed; exclude_img and exclude_mask are everything else - the complement. One node does the job of "give me the good ones" and "give me the rejects" at once, which is genuinely handy when you're triaging a generation batch and want to route winners one way while dumping the rest into a review path.

Installing it

This is one node inside the larger ComfyUI-WJNodes pack, so installing it means installing the whole thing. ComfyUI Manager: search "ComfyUI-WJNodes," install. By hand:

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

Restart, and you'll find it under WJNode → ImageEdit → Batch. No model downloads, no extra dependencies beyond a stock ComfyUI install - the author's requirements.txt step is really for the pack's optional integrations elsewhere, not for a straightforward batch-selection node like this one.

Where people get burned

The 1-indexing is the one thing that catches people coming from Python or any node that counts from 0 - type 0 expecting the first image and you'll get nothing for that entry, since 0 is out of range on a 1-indexed batch. Second: this node reorders on purpose. List 3,1,3,2 and you get exactly that sequence back, repeat included, since arbitrary repeats and reordering are explicitly supported. If your output batch looks scrambled or padded compared to what you expected, check your indexes string before assuming the node is broken.

CategoryWJNode/ImageEdit/Batch

Inputs (3)

NameTypeDefaultDescription
indexesSTRING1,2,
imagesoptIMAGE
masksoptMASK

Outputs (4)

NameTypeDescription
select_imgIMAGE
exclude_imgIMAGE
select_maskMASK
exclude_maskMASK