SRL Filter Image List
Keep only the batch frames that passed — filtering images by a boolean list
- images
- IMAGE
Generating a batch is the easy part of ComfyUI. Keeping only the good frames from that batch - the part you'd expect to be easy - is where the graph suddenly has nothing for you. SRL Filter Image List is a small piece of that machinery: you feed it a list of images and a matching list of booleans, and it outputs just the images where the boolean is true. One input list, one keep list, one filtered list out.
How it works
The node is flagged INPUT_IS_LIST, which is ComfyUI's way of saying both inputs arrive as lists rather than single values. images is a list of IMAGE tensors; keep is a list of booleans. The node zips them together and keeps each image whose corresponding boolean is true - Python's [im for im, k in zip(images, keep) if k], no more, no less. The output is a list of IMAGE, so it plugs straight into anything that consumes a batch: a save-animated node, a batch upscaler, or another list-processing step.
The inputs that matter
images(IMAGE, list) - your batch.keep(BOOLEAN, list) - one true/false per image. Note it'sforceInput, so it can't be a constant you type; it has to come from another node that emits a list of booleans.
The output is a filtered IMAGE list.
The fiddly part: where do the booleans come from?
ComfyUI core barely produces lists of booleans, so the keep list is usually the hard half of the puzzle. Typically you compute a per-image score somewhere (a CLIP/quality comparison, a mask-emptiness check, a similarity measure) and turn it into true/false per image - often via a small Python helper like this pack's own SRL Eval, which can build the list as it maps over your batch. That pairing - Eval computes the keep list, Filter Image List applies it - is the natural way this node gets used.
Two things will bite you. First, length: the node zips, so if keep is shorter than images, the tail of your batch silently disappears, and if it's longer, the extras are ignored. Keep them aligned. Second, order: the booleans must line up with the images in the same sequence, or you'll keep the wrong frames and not notice until you look closely. If you've ever filtered a batch by "is this face good," you know exactly how quickly that goes sideways.
Install
Same pack as the rest of SRL's nodes, and it's one of the safest of the four - no code execution here, just a zip and a filter. No dependencies, no downloads:
cd ComfyUI/custom_nodes && git clone https://github.com/seanlynch/srl-nodes
Or ComfyUI Manager → search "SRL's nodes" → Install, then restart. It's a quiet utility node - 0 search impressions, honestly, which is about right for the niche it fills. But if you've ever wanted to generate 20 frames and save only the 6 that passed, you'll be glad it's there.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| keep | BOOLEAN | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |