Load Images From Dir List
Dump a whole folder of images into the graph, sorted and capped
- IMAGE
- MASK
- FILE PATH
If you've ever needed to run a workflow over fifty images without loading them one at a time, this is the node. Load Images From Dir List reads every image in a folder and hands you a list of image tensors, masks, and file paths - batch processing in one step. The README credits Dr.Lt.Data's Inspire Pack as the inspiration, which tells you what tradition it's from: the "point me at a folder and give me the batch" school of ComfyUI loaders.
The outputs being lists (not a single batched tensor) is the important design decision. Downstream, you can iterate with the pack's loop system, feed each image through a detailer pass, or just concatenate them into one batch for batch sampling. The file paths come along for the ride, which matters more than you'd think - pairing each image with its filename is how you keep track of which output belongs to which input.
How it works
Give it a directory, and it scans for .jpg, .jpeg, .png, and .webp, sorts the list alphabetically, and loads each into an RGB tensor plus an alpha-derived mask (empty 64×64 mask if no alpha). The recursive toggle switches from a flat scan of one folder to an os.walk over subfolders, which is how you load a whole nested dataset in one shot. Files are loaded in sorted order, so "first N" actually means "first N alphabetically."
Three options control the selection:
- image_load_cap - stop after N images; 0 means no cap
- start_index - skip the first N files
- load_always - force a re-read on every queue run. Leave it off and ComfyUI caches results, so edits to the folder won't show up; turn it on and every run re-scans
The recursive flag plus start_index plus image_load_cap together let you page through a big folder like a dataset iterator.
Inputs and outputs
- directory - the folder path as a string (absolute paths, no dropdown)
- The four optional controls above
Outputs, all as lists: IMAGE, MASK, and FILE PATH (the full path string per image).
Installing it
Part of the XJNodes pack. ComfyUI Manager → search "ComfyUI-XJNodes" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/alexjx/ComfyUI-XJNodes
# restart ComfyUI
No dependencies to add. It appears under XJNodes/image.
Where to be careful
First, this is another "give me a real path" node - it doesn't know about ComfyUI's input-folder dropdown, and it raises FileNotFoundError if the directory doesn't exist or contains no valid images. Second, "list" is doing real work here: if your downstream node expects a batched IMAGE tensor (shape B×H×W×C) and you feed it a list, you'll get type errors. The pack's list utilities - and the loop system specifically, which was built to preserve lists as-is - are the intended companions. Third, watch memory: recursive on a 10,000-image dataset is 10,000 tensors in one go. Cap it or you'll find out what your RAM ceiling actually is. For single-image dynamic loading by path, the pack's Load Image By Path is the sibling to reach for instead.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | — | |
| image_load_capopt | INT | 0 | — |
| start_indexopt | INT | 00–18446744073709550000 | — |
| load_alwaysopt | BOOLEAN | false | — |
| recursiveopt | BOOLEAN | false | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |
| FILE PATH | STRING | — |