Image Batch Loader
Feed a whole folder through ComfyUI without babysitting the queue
- image
- filename
- image_count
- image_batch
- image_list
Here's the problem Image Batch Loader solves: you've got 200 photos you want to upscale, inpaint, or run through an img2img pass, and ComfyUI has no built-in way to walk a folder one image at a time. Either you rewire Load Image manually every run, or you queue up 200 separate workflows. Neither is fun. This node scans a directory, hands you one image per execution, and advances to the next one every time you hit Queue. That's the entire pitch, and it nails it.
It ships in Zar4X/ComfyUI-Batch-Process, a small pack built around exactly this "batch stuff in, batch stuff out" workflow - a loader, a saver, a text loader, and a LoRA loader that all share the same mental model.
How it works
Point directory at any folder and the node scans it once, caches the file list, and natural-sorts it (img2 comes before img10, which plain alphabetical sorting gets wrong). Each time the workflow executes, an internal counter advances and the next image in line comes out the image output. It wraps around at the end, so a queue run keeps cycling. You don't pick files; you pick a folder and let it walk.
Two inputs control the loop. mode gives you single_image, incremental_image, or random (the last one is seeded). Honest note: in the current code single_image and incremental_image behave identically - both advance through the folder - so don't overthink which one to pick. reset_on_queue is the one to understand: leave it at its default and a queue run advances normally; flip it 0→1 and the read index snaps back to the first image. That's your "start over" button.
The inputs that matter
directory- a full path to the folder. Required, and it throws a "not a valid directory" error if you typo it.search_title+filename_option+delimiter- together these filter which files count.filename_optiondecides whethersearch_titlematches against the whole name, the prefix, the suffix, both, or neither (the "nor" option is handy for excluding). The catch: filtering only kicks in whensearch_titleis non-empty, so leaving it blank just loads everything.start_index/end_index- 1-based range slicing if you only want, say, files 5 through 20.image_list- the memory bomb. Turn it on and the node loads every matching image into RAM at once and exposes them through theimage_listoutput. Leave it off unless you genuinely need the whole batch as a list; it will eat your VRAM on a big folder.subfolder- set true to recurse into subdirectories.
Four outputs: image, filename (extension stripped - handy for feeding a matching saver), image_count, and image_list (only filled when image_list is on).
Installing it
Same as the rest of this pack. In ComfyUI Manager, search ComfyUI-Batch-Process and hit install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Zar4X/ComfyUI-Batch-Process
Restart ComfyUI. That's it - no model downloads, and the only dependencies are Pillow and torch, both of which ComfyUI already ships.
Where people get burned
If the folder has no matching files, you don't get an error - you get a tiny black 64×64 image and a filename of "no_images_found". That's easy to mistake for a broken node or a corrupt input. Check the console for "No matching image files found" and double-check your path and filter before suspecting your GPU. And remember the wrap-around: incremental mode cycles forever, so a long queue will start re-feeding the first image once it hits the end. That's usually exactly what you want, but it'll confuse you the first time you notice it.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | — | |
| search_title | STRING | — | |
| delimiter | STRING | — | |
| mode | COMBO | incremental_image | 3 options: single_image, incremental_image, random |
| seed | INT | 00–18446744073709550000 | — |
| filename_option | COMBO | 5 options: filename, prefix, suffix, prefix & suffix, prefix nor suffix | |
| image_batch | BOOLEAN | false | Load all matching/filtered images in the directory as a single batched IMAGE tensor (B,H,W,C). Images of differing sizes are center-padded to the max resolution so they can be concatenated. |
| image_list | BOOLEAN | false | — |
| subfolder | BOOLEAN | false | — |
| start_index | INT | 00–999999 | Start index (1-based). Use 0 to start from beginning, or set 1 for first image, 2 for second image, etc. |
| end_index | INT | 00–999999 | End index (inclusive, 1-based). Use 0 to include all remaining images, or set >0 to limit range (1=first, 2=second, etc.). |
| reset_on_queueopt | INT | 10–1 | Any change to this value (0↔1) resets the read index to start from the first image again. Keep unchanged during a queue run to advance normally. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| filename | STRING | — |
| image_count | STRING | — |
| image_batch | IMAGE | — |
| image_list | IMAGE | — |