Nodes/ComfyUI-list-filter/Filter Image List
ComfyUI Node

Filter Image List

Send only the frames you picked to the upscaler — not the whole batch

By Kesin11·Created 2 years ago·Updated about a year ago· 1
Filter Image List
  • image_list
  • image_list
index_list0
return_first_if_nonetrue

Filter Image List is the flagship of Kesin11's ComfyUI-list-filter pack, and the one you'll actually build workflows around. It takes a batch of images and keeps only the ones at the indices you give it. Sounds trivial until you need it: you ran a 20-frame batch, you liked three of them, and you want to send only those three through a face fixer or an upscaler without redoing the other seventeen.

That's the exact loop the pack's README is built around. ComfyUI-Image-Selector is the node for picking frames out of a batch, and its selected_indexes come out as a string. You run those through Index List From String to get real indices, then into this node. The result: a clean IMAGE list containing just your picks, ready for whatever post-processing you had in mind - FaceDetailer-style detail passes, tiled upscaling, or just saving.

How it works

A list comprehension with an out-of-range guard: [image_list[i] for i in index_list if i < len(image_list)]. Indices past the end of the batch are dropped instead of crashing the graph - convenient, but silent.

The third input is where it gets interesting. return_first_if_none (default on) means: if your filtering produces an empty list, hand back the first image instead. That's a deliberate design choice, because an empty IMAGE list is a classic way to kill a downstream node - nothing to process, tensor-shape error, red node. Returning the first image keeps the pipeline alive.

The inputs that matter

  • image_list - the batch of images to filter (IMAGE).
  • index_list - the INT indices to keep. Comes from Index List From String (list_filter_StringToIndex) when your selection started as text.
  • return_first_if_none - BOOLEAN, default true. Flip it off if an empty selection should stay empty (say, when you expect nothing to match and don't want a surprise first-frame).

The one output, image_list, is the filtered batch - exactly what a VAE decode, upscaler, or save node wants to eat.

Installing it

Part of the ComfyUI-list-filter pack, so it installs with its five siblings:

  • ComfyUI Manager - search ComfyUI-list-filter, install, restart.
  • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/Kesin11/ComfyUI-list-filter, then restart ComfyUI.

No requirements.txt, no model downloads, no GPU dependencies. The pack is pure Python with no imports beyond random, so there's nothing to pip-install and nothing to conflict with your other nodes. About as friction-free as a custom node install gets.

Gotchas worth knowing

  • return_first_if_none defaults to on. If you filter everything out and get a single image you didn't pick, this is why. It's a feature, but it will absolutely surprise you the first time.
  • Out-of-range indices vanish silently. [0, 99] on a five-frame batch gives you one frame, no error.
  • Zero-based indexing, like every list node in ComfyUI. 0 is the first image.
  • If you're pairing it with Find Any Strings after a WD14 Tagger pass, you can filter to exactly the images carrying a given tag - the finder gives you the indices, this node gives you the pixels.

For anyone doing batch generation with a human-in-the-loop pick step, this node is the difference between reprocessing everything and reprocessing what you meant to. It's small, boring, and quietly essential.

Categorylist-filter

Inputs (3)

NameTypeDefaultDescription
image_listIMAGEThe list of images to be filtered.
index_listINT0The list of indices to filter the image list.
return_first_if_noneBOOLEANtrueReturn the first image if the filtered list is empty.

Outputs (1)

NameTypeDescription
image_listIMAGEThe filtered list of images.