Nodes/comfy-ovum/Load images list (regex/custom filter + callback)
ComfyUI Node

Load images list (regex/custom filter + callback)

Load images list (regex/custom filter + callback) — a batch image loader with an opinionated filter

By sfinktah·Created about a year ago·Updated 10 months ago· 7
Load images list (regex/custom filter + callback)
  • prev_image_exs
  • filenames
  • IMAGE
  • MASK
  • FILEPATH LIST
  • CALLBACK DATA LIST
  • PROMPT&WORKFLOW LIST
  • IMAGE_EX LIST
  • exhausted
directory
regex
custom_filter_class
start_index0
image_load_cap0
recursefalse
load_alwaysfalse
sort_method
invoke_callbackfalse
callback_messageovum.image_list.info

This is the "load a whole pile of images at once" node, with enough filtering to be useful in the real world. Point it at a folder, or hand it an explicit list of filenames, and it loads every matching image into a batch - with a regex filter, a recursion option, a dozen sorting methods, an exhausted flag for loop-driven batches, and an optional callback that pings the frontend when a batch loads.

It's the workhorse behind "process every frame in this directory" workflows - frame extraction from video, batch img2img passes, training-set prep. The pack's README slots it into the "Image List Loader + Folder Paths" family, and it's the most configurable of that bunch. The downside of all those options is a busy input list; you'll ignore most of it most of the time.

The inputs you'll actually touch

Everything except the outputs is optional, per the schema:

  • directory (STRING) - the folder to scan. Leave it blank and use filenames instead.
  • filenames (LIST) - an explicit list of paths, as an alternative to directory scanning. Relative paths resolve against the input/output roots.
  • regex (STRING) - only files whose name matches this regex are included. Leave blank for everything.
  • recurse (BOOLEAN) - scan subdirectories (rglob) instead of just the top level.
  • sort_method - one of 12 options: none (and reversed), alphabetical, numerical, or by access/creation/modification time, each ascending or descending.
  • start_index / image_load_cap - skip the first N files, or cap the total loaded. Cap 0 = no cap.
  • load_always (BOOLEAN) - force a fresh load every run instead of letting ComfyUI cache by parameters.
  • invoke_callback + callback_message - when enabled, posts a message (default ovum.image_list.info) to the frontend when the batch is ready, so UI extensions can react.
  • custom_filter_class (STRING) - the power user option: a dotted path like mypkg.MyFilter to a class with an accept(name, path) method. It's dynamically imported and called per file; if it returns falsy, the file is skipped. A regex can't express "only files whose EXIF date is after Tuesday," but a custom filter can.

Outputs

  • IMAGE (list) and MASK (list) - the loaded images and their alpha masks, ready for a batch pipeline.
  • FILEPATH LIST - the resolved paths, for filename logic or saving.
  • CALLBACK DATA LIST - payloads built from the callback machinery, for driving UI or logging.
  • PROMPT&WORKFLOW LIST - embedded workflow metadata from each image that has it.
  • IMAGE_EX LIST - one IMAGE_EX bundle per image for the pack's metadata-aware nodes.
  • exhausted (BOOLEAN) - this is the loop flag. When start_index runs past the available files, it goes true, telling a repeat-loop to stop. That's what lets you iterate over a big folder in chunks across runs.

How the filtering actually works

The node is strict about what counts as an image: extensions are whitelisted to .jpg, .jpeg, .png, .webp, .bmp, .gif. Then the regex (if any) runs against the filename via re.search, then the custom filter (if any) gets its accept(name, path) call. A missing directory raises FileNotFoundError rather than silently returning nothing. The exhausted flag flips when start_index exceeds what's left.

Install

Ships in comfy-ovum:

cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum

or ComfyUI Manager → comfy-ovum, restart. No models, no keys. The requests and pillow deps in the pack's requirements.txt are what the loader leans on, and Manager installs them.

Gotchas

  • load_always and invoke_callback disable caching - the node's IS_CHANGED returns NaN in those modes so it always re-runs. That's the point (you want the callback every load), but it means ComfyUI won't skip the node on repeat runs.
  • A bad custom_filter_class silently degrades to no custom filter - the dynamic import is wrapped in try/except, so a typo won't crash the graph; it'll just quietly load everything. Check the console if your filter seems to be doing nothing.
  • Non-image extensions are skipped, not error - the whitelist is deliberate; if "missing" images confuse you, verify the extension is in the list.
  • Directory must exist or you'll get a FileNotFoundError, not an empty load.
Categoryovum/image

Inputs (12)

NameTypeDefaultDescription
prev_image_exsoptLIST
directoryoptSTRING
filenamesoptLIST
regexoptSTRING
custom_filter_classoptSTRING
start_indexoptINT00–18446744073709550000
image_load_capoptINT0
recurseoptBOOLEANfalse
load_alwaysoptBOOLEANfalse
sort_methodoptCOMBO12 options: None, None (Reversed), Alphabetical (ASC), Alphabetical (DESC), Numerical (ASC), Numerical (DESC), +6
invoke_callbackoptBOOLEANfalse
callback_messageoptSTRINGovum.image_list.info

Outputs (7)

NameTypeDescription
IMAGEIMAGE
MASKMASK
FILEPATH LISTLIST
CALLBACK DATA LISTLIST
PROMPT&WORKFLOW LISTLIST
IMAGE_EX LISTLIST
exhaustedBOOLEAN