Load Batch From Dir (Creepybits)
The loop-friendly loader that remembers where it left off
- trigger
- IMAGE
- MASK
- current_index
Despite the name, this is not a batch loader. Load Batch From Dir is an iterator: it loads exactly one image per run, and its superpower is increment mode, where each run pulls the next image in the folder and remembers where it was between runs. That makes it the engine for the classic batch-img2img loop - process folder of images one at a time, and no matter how many times you run the workflow, it never re-processes the same image twice by accident.
It also shares its display name ("Load Batch From Dir") with the pack's other loader, the full-batch one. The tell is the iteration_mode dropdown - if you see that, you're on the right node.
How it works
It scans directory, sorts the image files alphabetically, and picks one based on iteration_mode:
fixed- always the first image in the folder. Boring, but handy for testing.increment- the star. It reads its position from a state file, loads that image, and writesposition + 1back. The index wraps around when it hits the end, so long-running loops restart cleanly.random- a random image each run, useful for variation without looping.
The state lives in a JSON file at ~/.creepybits_loader_state.json (your home directory), keyed per directory. That's how it remembers - not in the workflow, not in ComfyUI, but on disk. The persistence also means the counter survives ComfyUI restarts, which is exactly what you want for a batch job you run in pieces.
There's also an optional trigger input. It's a wildcard socket with a devious purpose: the code accepts it and then ignores it entirely. Wiring a changing value (like a counter or an image output) into it forces the node to re-execute, which is what makes loops tick. It's a "poke to run again" wire, not a data wire.
Outputs
Three, matching the standard loader contract:
IMAGE- the single loaded image, ready for img2img or processing.MASK- an alpha mask if the image has transparency, otherwise an all-ones mask.current_index- the position of the image you just got. Feed it back into your loop logic or display it.
Installing it
In ComfyUI-Creepy_nodes:
- ComfyUI Manager: search "Creepy_nodes" and install.
- Manual:
cd ComfyUI/custom_nodes git clone https://github.com/Creepybits/ComfyUI-Creepy_nodes.git
Restart ComfyUI. No extra dependencies.
Troubleshooting
Two real gotchas, both worth knowing before you build a loop around this node. First, the shipped extension filter is buggy: webp is missing its leading dot in the source, so .webp files are silently skipped while .png/.jpg/.jpeg/.gif load fine. If some of your images never show up in the sequence, that's why. Second, the state file can bite you - if you switch directories mid-project, each directory keeps its own counter, and if you ever delete the state file (or move machines), increment restarts from the first image. When in doubt, check ~/.creepybits_loader_state.json.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | C:/path/to/your/images | — |
| iteration_mode | COMBO | 3 options: fixed, increment, random | |
| triggeropt | * | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |
| current_index | INT | — |