Load Random Image π²
Pull a random file out of a folder, seeded
- image
- image name
Point it at a folder, and it hands you back one random image from inside it, plus that image's filename. That's the whole node - no cropping, no filtering, just "grab one." It shows up more than you'd expect in workflows that need a source image but don't care which one: random b-roll for a video-from-images pipeline, a random reference frame for testing a ControlNet setup, or just shuffling through your own output folder to see what you've made without manually opening a file browser. It's genuinely one of the more-recommended nodes in this pack for exactly that "grab me something from this pile" use case.
How it works
seed picks the image, not images_directory's contents directly - the node reads the directory, and the seed value determines which file in it gets selected. Because it's a seed rather than a "shuffle" button, the same seed against the same folder contents will always return the same image, which matters if you want reproducibility inside a batch, and you can bump or randomize the seed the normal ComfyUI way (right-click the widget, or set it to increment/randomize) to get a different pick each run.
The inputs and outputs that matter
images_directory- full path to the folder to pull from. The default,/tmp/ComfyUI/output, is a Linux-container-style path - on a typical desktop install (especially Windows) you'll need to point this at your actual output or input folder before it does anything useful.seed- 0 to 4095. Small range by this pack's standards, but plenty if you're just cycling through a folder rather than trying to hit astronomical uniqueness.
Outputs: image (the picture itself, ready to wire anywhere an IMAGE input is expected) and image name (a STRING with the filename - handy if you want to log which file got picked, or feed it into something like Add Text Overlay so the output image is labeled with its own source filename).
Installing it
Via ComfyUI Manager: search "iTools" or "ComfyUI-iTools," install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/MohammadAboulEla/ComfyUI-iTools
then restart. No special dependencies for this one - it's just reading files off disk.
Troubleshooting
Node errors or returns nothing on load. Nine times out of ten this is the default /tmp/ComfyUI/output path - it doesn't exist on your machine. Set images_directory to a real, absolute path to a folder that actually contains images before you try anything else.
Same image every time even though you're re-running the graph. ComfyUI caches node output when its inputs haven't changed, and a fixed seed plus an unchanged directory is "unchanged inputs" as far as the graph is concerned. Set the seed widget to randomize (or increment) if you want a fresh pick on every queue.
Folder contents changed but you're still getting old files. If you deleted or added images to the directory since ComfyUI started, and the node still seems to be picking from the old set, requeue the workflow - the directory listing is read at execution time, not cached across the whole session, so this is usually a stale-preview issue rather than the node actually being wrong.
You want deterministic variety across a batch run, not just one random pick. Increment the seed per run rather than randomizing - a fixed sequence of seeds (0, 1, 2, 3β¦) against a stable folder gives you a reproducible tour through the directory instead of a truly random shuffle, which is useful if you need to regenerate the exact same batch later.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images_directory | STRING | /tmp/ComfyUI/output | β |
| seed | INT | 00β4095 | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | β |
| image name | STRING | β |