⛧Load Images Conditional
A loader with an on/off switch, and that's the point
- images
- count
ComfyUI's stock LoadImage loads one image and is permanently on. Load Images Conditional is the version with a switch - the "condition" in the name is just a boolean called enabled. Flip it off and the node returns an empty batch without touching your disk, which lets you gate an entire image-loading branch on a workflow setting instead of deleting nodes or rerouting wires.
So why bother? In this pack's Wan loop workflows, this is the workhorse loader: it's what Load Image Folders calls internally for every numbered folder, and it's what you'd use directly when you want a folder's worth of frames loaded as one batch - for example, feeding a chunk of previously rendered frames back into a video continuation pass.
What it takes, what it gives
- folder_path - the directory to load. Relative paths are resolved against ComfyUI's
input/folder; absolute paths work as-is. - enabled -
trueloads,falsereturns an empty batch instantly. Default on.
Outputs:
- images - a single
IMAGEtensor stacking every image in the folder, sorted by filename ascending. One batch, not one-per-file. - count - an
INT, how many images made it into the batch. This is the part people underuse: wirecountinto a conditional downstream and you can branch on "did this folder have the expected number of frames?"
The mechanism, briefly
Enabled path: it scans the folder (os.scandir, which is faster than listdir), sorts by name, and converts each file to an RGB float tensor. Corrupt or unreadable files are silently skipped - so a half-written PNG from a crashed render doesn't kill your queue, it just lowers count. Disabled path: returns torch.zeros((0, 64, 64, 3)) and 0, no disk access. Missing folder, empty folder, or zero valid images all raise a ValueError with a readable message.
The empty-batch behavior is worth understanding: when disabled, you get a zero-length batch, not a black frame. Downstream nodes that assume at least one frame will still see a batch - just an empty one. If that breaks something, branch on count instead of relying on the empty tensor to behave like nothing.
Install and context
The node lives in ComfyUI-HeresyNodes, heresyCoder's small pack of personal support nodes for Wan video loop pipelines:
cd ComfyUI/custom_nodes
git clone https://github.com/heresyCoder/ComfyUI-HeresyNodes
Restart afterward; ComfyUI Manager also finds it under "ComfyUI-HeresyNodes". No model downloads, no extra Python dependencies.
The honest take
This is a loader with a toggle - if you never need the toggle, ComfyUI's built-in nodes already cover you. But the conditional-load pattern is genuinely useful once you're automating reruns: same graph, different enabled setting, and a whole reference-image branch switches on or off. Combined with the count output, it also doubles as a folder validator for exactly the kind of resume-friendly pipelines this pack is built around. Reach for it when you want the load itself to be part of the workflow's logic, not a fixed step.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | — | |
| enabled | BOOLEAN | true | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| count | INT | — |