Load Image Batch (Fun)
Load Image Batch that finally lets you run two of them at once
- image
- filename
- count
Load Image Batch (Fun) is a fixed version of the classic Load Image Batch node, and the fix is a specific one: the original had a bad habit of sharing state between instances, so if you dropped two batch loaders into the same workflow they'd fight over the same index and silently load the wrong images. This version gives every instance its own state, which the author documents as "the key fix for supporting multiple instances." If you've ever seen two loaders in one graph behave like they're reading each other's minds, you know exactly why this node exists.
Mechanically it's a directory loader with three selection modes:
- single_image - pick the image at
index(wraps around if you exceed the count). - incremental_image - each queue run advances to the next file and remembers where it is, per instance. This is the mode you use to iterate through a folder one run at a time.
- random - pull a random file each run.
The node caches the file list keyed by a hash of path + pattern, so it only rescans the directory when those change - and crucially, that cache is per-instance, which is the whole multi-instance fix in action.
The inputs you'll actually touch:
- path - the directory. There's no default, and the code raises
ValueErrorthe moment it's empty. This trips people more than anything else: the node refuses to run until you set a real folder. - pattern (default
*) - a glob filter.*.pngor*.jpgif you want to exclude other files. - mode - the three-way choice above.
- index - which file, used in single_image mode.
- label - just a name for the batch; shows up in logs.
- allow_RGBA_output - false/true, whether to pass alpha through.
Outputs: image (the loaded image, wire it into whatever you're batch-processing), filename (the selected file's name as a string - handy for saving outputs with matching names), and count (how many files matched, useful for loop math in batch workflows).
It's a small utility, and honestly most of the value is the reliability fix. If you've never hit the original's multi-instance bug, this node reads as just "another batch loader," which is fine - the category is crowded with Load Image Batch clones, and the honest thing this one does is exist without the footgun. Pair it with the pack's Indexed String Selector or Dynamic Queue Counter and you can build real "iterate a folder" loops where the index, the filename, and the count all stay in sync.
Install is the pack standard: ComfyUI Manager search "Node Fun", or clone https://github.com/nofunstudio/Node_Fun_ComfyUI into custom_nodes, pip install -r requirements.txt, restart. No models, no keys, no API. The only real gotchas are the empty-path error above and remembering that incremental_image state lives on the node instance - copy-paste the node to get a second independent counter, don't reuse the same one if you want both to stay in step.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | 3 options: single_image, incremental_image, random | |
| index | INT | 00–150000 | — |
| label | STRING | Batch | — |
| path | STRING | — | |
| pattern | STRING | * | — |
| allow_RGBA_output | COMBO | 2 options: false, true |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| filename | STRING | — |
| count | INT | — |