RandomImageFromDir
A random image from a folder — that's the whole node
- Random Image
This is the node the author forgot he shipped. RandomImageFromDir is categorized as _for_testing, it's the only one of the five in this pack that doesn't appear in the README at all, and its entire job is to pick a random .png, .jpg, or .jpeg out of a folder and hand it to you as an IMAGE. That's it. No controls, no seeding, no filtering. One input (dir, a path string defaulting to C:/Poses), one output (Random Image).
So why does it exist, and why should you care? The default path is the tell: C:/Poses. The author was building animation workflows where you img2img across a set of pose references, and instead of hand-picking a pose image every run, he wanted the node to roll the dice for him. Drop a folder of reference images in, wire Random Image into an IPAdapter or a control net, and every queue gives you a different pose to work from. It's a crude A/B sampling tool - useful for hammering through style tests without touching the mouse.
The one bit of real mechanism here is IS_CHANGED, which returns random.random(). In ComfyUI, that's the standard trick to force a node to re-execute on every queue instead of caching its output - without it, ComfyUI would compute the "random" pick once and then treat it as done, which would make the node useless. So yes, it genuinely re-rolls each run. It also loads through PIL, which means it doesn't need the OpenCV dependency the rest of the pack drags in - though you'll get that dependency anyway since they all ship together.
Honest limitations, all from the source: the extension filter is lowercase and hardcoded, so .PNG or .webp files are invisible to it. An empty folder, or one with no matching files, makes random.choice throw an IndexError - no graceful message. And since nothing here sorts or dedupes, you can get the same image twice in a row. That's fine for a test node; it would be annoying for real work.
Reach for this only for the quick-and-dirty case it was built for: grab a random reference from a folder on each run. For anything more deliberate, a normal LoadImage and your own hand is the better tool. But it installs in the same command as the rest of the pack, costs nothing, and when you need a random pose on demand, it delivers.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| dir | STRING | C:/Poses | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Random Image | IMAGE | — |