๐ผ> Load Image From Folder
Batch through a directory without a batch loader
- image
- file_name
The vanilla Load Image node makes you pick one specific file from a dropdown. That's fine for a single generation, useless the moment you want to run the same workflow over a folder of reference images or iterate through a batch one at a time. Load Image From Folder covers both of the actual use cases people want: grab a random image from a folder, or step through a folder in order.
Point it at a subfolder inside your ComfyUI input directory (or leave it blank and it reads straight from input itself), and it either picks a random file each run or, if you drive the index input yourself, walks through the folder file by file. That second mode is the one worth knowing about - it turns a single-image workflow into a folder batch processor without adding a separate "batch runner" system.
How it works
Leave index at its default of -1 and the node grabs a random image from the folder on every run - good for style-testing across a reference set, or just varying inputs without manually swapping files. To iterate instead, wire a Primitive node into index, set it to 0, and set its control mode to increment. Each queue run bumps the primitive by one and the node loads the next file in the folder; run it batch-of-N times through the ComfyUI queue and you've processed N images in order. When you want to start the pass over, reset the primitive back to 0.
The inputs and outputs that matter
image_folder(STRING, default empty) - the folder name, relative to yourinputdirectory. It has to already exist insideinput; the node doesn't create it or read from arbitrary filesystem paths. Leave it empty to pull directly frominputitself.index(INT, optional, default-1) --1means random pick. Anything0or above selects that position in the folder, which is what you drive with a Primitive to iterate.
Two outputs: image (the loaded IMAGE) and file_name - the actual filename, which is genuinely useful downstream. Feed it into YANC's own Text Combine to build a matching output filename in Save Image, so your batch-processed outputs keep traceable names instead of the generic ComfyUI_00001 sequence.
How to install it
Via ComfyUI Manager: search "yanc" or "YANC - Yet Another Node Collection," install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ALatentPlace/ComfyUI_yanc
then restart. No extra Python dependencies, no models to fetch - it's reading files off disk with Pillow, which ComfyUI already depends on.
Common issues & troubleshooting
"Folder not found" or nothing loads. The folder has to live inside ComfyUI/input/, not somewhere else on disk - this node isn't a general file browser, it's scoped to ComfyUI's input directory the same way the vanilla Load Image node is. Double-check the name you typed matches the subfolder exactly, including case.
Iteration doesn't advance. This trips people up on any "wire a Primitive to index" node, not just this one: the Primitive has to actually be set to increment mode, not just have its value manually bumped, and you need to queue multiple runs (or a batch count) for the stepping to happen at all. If you queue once, you get one image.
It keeps loading the same random image. That's not a bug so much as how randomness in ComfyUI generally works when nothing else in the graph changes between runs - some setups cache identical inputs. If you need a different random pick every single queue, that's the same class of "force re-execution" issue any non-seeded random node runs into; adding a changing dummy input (like a seed control set to increment) is the usual workaround.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image_folder | STRING | โ | |
| indexopt | INT | -1-1โ18446744073709550000 | โ |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | โ |
| file_name | STRING | โ |