Load Images From Dir Batch
Folder loader that also gives you filenames
- image
- mask
- count
- filenames
- full_paths
- path_only
This one exists to fix a specific, nagging gap. If you've done batch img2img in ComfyUI you've probably used Inspire Pack's "Load Image Batch From Dir" - solid node, loads a folder of images as a batch. But it doesn't tell you the filenames. So when you save your results, they come out with generic names and you've lost the thread of which output came from which input. Load Images From Dir Batch is aidec's modified version of that node with exactly one goal: also hand you the names.
That sounds small. It isn't, if you run big img2img batches. The author's actual use case is the giveaway - with the filenames in hand you can make your output images keep the same name as their source, so a reference image and its generated result sit next to each other in the folder, obviously paired. For any workflow where you'll be eyeballing before/after across hundreds of files, that traceability is the difference between usable and a mess.
How it works
It reads the images from a directory into a batch (same general behavior as the Inspire node it's based on), and alongside the pixel data it emits the names and paths as plain comma-joined strings. filenames gives you img1.png,img2.png,…; full_paths gives you the complete path to each. You then pass those strings to something that can pick out one entry by index - the pack's own Image Filename Processor is built for exactly that - so the name stays synced with whatever image your queue is currently on.
The inputs that matter
- directory (required) - the folder to load. That's the core of it.
- image_load_cap (optional) - a limit on how many to read; 0 means all of them. Handy for testing on a subset before you commit to the whole folder.
- start_index (optional) - skip ahead in the folder.
- load_always (optional) - force the node to re-run instead of serving ComfyUI's cached result. Turn this on when the folder's contents change between runs and you want the loader to actually look again.
Outputs: image and mask (into your pipeline), count (how many it loaded), and the reason you're here - filenames, full_paths, and path_only (the directory). Route filenames or full_paths into Image Filename Processor with your queue's current index to get the matching single name.
Installing it
cd ComfyUI/custom_nodes && git clone https://github.com/aidec/Comfyui_TextBatch_aidec, then restart ComfyUI (or ComfyUI Manager → Install via Git URL). No models or extra dependencies. Unlike most of the pack it files under the image category, not TextBatch.
Where people get burned
- It loads into memory. Like the Inspire node it's built from, this pulls the batch into RAM. For a truly large folder in a serial img2img loop, the pack's Image Queue Processor Pro - which lazy-loads one image at a time - is the lighter choice. Use this when you specifically want the filename strings, and cap it with
image_load_capif the folder is huge. - Mixed image sizes. Batched image tensors generally want matching dimensions; a folder of wildly different resolutions can trip up loaders that stack them. If it complains, normalize sizes or process in smaller groups.
- Server-side paths. On a hosted/serverless ComfyUI,
directoryis a path on the server, not your laptop - upload the images somewhere the ComfyUI process can read. - Stale cache. If you swapped the folder's files but the node hands back the old set, that's ComfyUI caching - flip
load_alwayson.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | — | |
| image_load_capopt | INT | 0 | — |
| start_indexopt | INT | 0 | — |
| load_alwaysopt | BOOLEAN | false | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| count | INT | — |
| filenames | STRING | — |
| full_paths | STRING | — |
| path_only | STRING | — |