Load images list (regex/custom filter + callback)
Load images list (regex/custom filter + callback) — a batch image loader with an opinionated filter
- prev_image_exs
- filenames
- IMAGE
- MASK
- FILEPATH LIST
- CALLBACK DATA LIST
- PROMPT&WORKFLOW LIST
- IMAGE_EX LIST
- exhausted
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 usefilenamesinstead.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 (defaultovum.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 likemypkg.MyFilterto a class with anaccept(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) andMASK(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- oneIMAGE_EXbundle per image for the pack's metadata-aware nodes.exhausted(BOOLEAN) - this is the loop flag. Whenstart_indexruns 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_alwaysandinvoke_callbackdisable caching - the node'sIS_CHANGEDreturnsNaNin 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_classsilently 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.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| prev_image_exsopt | LIST | — | |
| directoryopt | STRING | — | |
| filenamesopt | LIST | — | |
| regexopt | STRING | — | |
| custom_filter_classopt | STRING | — | |
| start_indexopt | INT | 00–18446744073709550000 | — |
| image_load_capopt | INT | 0 | — |
| recurseopt | BOOLEAN | false | — |
| load_alwaysopt | BOOLEAN | false | — |
| sort_methodopt | COMBO | 12 options: None, None (Reversed), Alphabetical (ASC), Alphabetical (DESC), Numerical (ASC), Numerical (DESC), +6 | |
| invoke_callbackopt | BOOLEAN | false | — |
| callback_messageopt | STRING | ovum.image_list.info | — |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |
| FILEPATH LIST | LIST | — |
| CALLBACK DATA LIST | LIST | — |
| PROMPT&WORKFLOW LIST | LIST | — |
| IMAGE_EX LIST | LIST | — |
| exhausted | BOOLEAN | — |