Load Image From Folder
Feed a whole folder to the queue, one image at a time, untouched
- IMAGE
- MASK
- filename
- filepath
- index
- total_images
Stock ComfyUI's LoadImage wants you to upload or drag a file, and it resizes to a power-of-two-friendly size along the way. If your job is processing a folder of images one at a time - a batch queue, or feeding frames to a vision LLM that wants the true resolution - both of those behaviors are wrong. Load Image From Folder exists for exactly this: point it at a directory (or a single file), and it hands you one image, at its exact original resolution, with an index you can advance across the queue.
The design is built for automation. index is a full INT input with control_after_generate support - set it to increment, randomize, whatever, just like a seed - and it wraps around: when the index exceeds the file count it loops back to the first image, so a long queue run never hits a "file not found." You can also wire the index output back into the input if you want deterministic stepping from your own logic.
The inputs:
path- a directory, or a direct file path. It also resolves Windows paths to WSL paths automatically (C:\Users\...→/mnt/c/Users/...), which is a small blessing if you run ComfyUI under WSL but keep files on the Windows side.index(INT, default 0) - which image, withcontrol_after_generatefor queue automation.sort_by-name,date_modified,date_created, orrandom. Random is seeded by the current index, so a given index is reproducible - same index, same "random" file, which keeps queue runs comparable.reverse(boolean) andsubfolders(boolean, recursive) - sort direction and whether to walk subdirectories.
The outputs are richer than most loaders:
IMAGE- the exact original resolution, no resizing, shape[1, H, W, 3].MASK- an alpha mask if the file has one, otherwise zeros.filenameandfilepath(STRING) - what you loaded and where, useful for logging or renaming saves to match.indexandtotal_images(INT) - current position and how many images were found, so you can build "image 3 of 17" logic.
It also previews the loaded image right on the node after each run, which sounds minor and turns out to be the difference between trusting a batch and babysitting it.
Install is the pack standard:
cd ComfyUI/custom_nodes
git clone https://github.com/xeinherjer-dev/ComfyUI-XENodes.git xenodes
or search "ComfyUI-XENodes" in ComfyUI Manager, then restart. No models, no pip deps for this node.
Where people get burned, and it's worth saying plainly. First, no resizing means exactly that - an 8000px scan will blow through VRAM in an img2img pass if you feed it straight to a sampler; this node is built for vision-LLM and queue use, not for blindly chaining to diffusion without a resize upstream. Second, random sort makes the node uncacheable by design - it always reruns (the fingerprint is random), which is correct for its job but means it and everything downstream re-execute every run; don't be surprised by that. Third, a path that doesn't exist raises a clear FileNotFoundError, not a silent fallback. And the pack gotcha applies as always: if no XENodes nodes appear, check the console - the pack imports together, and SaveAudio's PyAV (av) import is the usual culprit.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| path | COMBO | output | Select a folder from the output or input directory. |
| index | INT | 00–18446744073709550000 | Image index. Supports auto-incrementing / randomizing via control_after_generate for batch queue runs. |
| sort_by | COMBO | name | Sorting method for files in the directory. |
| reverseopt | BOOLEAN | false | Reverse the sort order. |
| subfoldersopt | BOOLEAN | false | Include images in subdirectories recursively. |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | Loaded image tensor [1, H, W, 3] without resizing. |
| MASK | MASK | Alpha mask if present, otherwise zeros. |
| filename | STRING | Filename of the loaded image. |
| filepath | STRING | Full filepath of the loaded image. |
| index | INT | Current index within the image list. |
| total_images | INT | Total count of images found. |