Random Image Picker
Stop hand-loading your reference folders one file at a time
- image
The moment you've felt this: you're iterating a style-transfer or img2img loop, and you want each run to pull a different photo out of your reference folder. Core ComfyUI's LoadImage makes you pick one file by hand every single time - fiddly, and it doesn't "work" as a batch at all. Random Image Picker is the fix. It's a single loader node that does two things: give you a browser file-picker button that behaves like LoadImage, and - the part that's actually worth installing for - randomly grab an image out of a folder on every execution. Nothing else in this little pack; it's one node with one job.
What it actually is
A small, dependency-free image loader in the image category. Flip folder_mode and it becomes a random sampler over a directory. There's no API, no model files, no key. One honest quirk: some crawlers describe it as "saves the input images to your output directory" because the node subclasses ComfyUI's SaveImage and writes its loaded image to temp so you get a live preview. Don't be misled - it's a loader; the save is just how the preview works.
How it works
In Single mode the node adds a 📁 Choose File button to the UI. Click it, pick an image, and the front-end uploads it to ComfyUI's /upload/image endpoint, stashes a [temp] reference in the hidden image_data widget, and shows the image instantly without a queue run. Pick a file and it also auto-flips you to Single mode, so the node is never left in a weird state.
Folder mode is the star. Give it a folder_path (defaults to your ComfyUI input directory), optionally turn on include_subfolders, and on execution it scans for .png, .jpg, .jpeg, .webp, .bmp, .gif, then does random.choice() on the list. The seed input makes the pick reproducible - same seed, same folder, same image. One caveat worth knowing: it seeds Python's global random module, so anything else in your session touching random can shift the result, and reproducibility depends on the folder's listing order staying put. Don't treat it as a cryptographic RNG; treat it as "same run, same file."
The inputs that matter
You really set three of these; the rest take care of themselves:
- folder_mode - the toggle. Off = single file, on = random from folder.
- folder_path - where to look when
folder_modeis on. Note the default points atinput/; if your images live elsewhere, change it or your "random" folder is whatever you last left in ComfyUI's input dir. - seed - set it when you want a reproducible pick.
include_subfolders is self-explanatory, and image_data is the hidden widget the file picker fills in - you should never touch it by hand. The single output is image, a standard [1, H, W, 3] RGB float tensor (0–1), so it plugs straight into VAE decode, IP-Adapter reference inputs, ControlNet preprocessors, or any img2img pipeline - same socket as LoadImage.
Installing it
The README says Manager registration is "coming soon," so the reliable path is the clone:
cd ComfyUI/custom_nodes
git clone https://github.com/solidlime/Comfyui-Random_Image_Picker.git
Restart ComfyUI and the node appears under image → Random Image Picker. No extra pip dependencies - the pack's own pyproject.toml declares an empty dependency list, so it leans entirely on ComfyUI's built-in Pillow, NumPy, and PyTorch. That's the good kind of custom node.
Gotchas
- "No image files found" is the most common folder-mode error, and it's almost always a path problem: wrong slash direction on Windows, a path that doesn't exist, or a folder full of unsupported formats. The error message tells you exactly which.
- Single mode errors when you run without picking a file first - the node helpfully tells you to hit the button.
- The file-picker button needs a modern browser and works client-side, so if clicking it does nothing, clear your cache and reload (and check the browser console, which the author explicitly points you to).
- If you just wanted random files and can't be bothered with the two-mode dance: set
folder_modeon, pointfolder_pathat your folder, leave the seed alone, and it happily loops through references run after run - which is honestly the best reason to install this over stock LoadImage.
It's a small pack, and it doesn't reinvent anything grand. But for anyone feeding folders of reference images through img2img or IP-Adapter workflows, it's one of those "how did I live without this" utility nodes.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | /tmp/ComfyUI/input | Folder path for random image selection (Folder mode only) |
| folder_mode | BOOLEAN | false | Single: Use file picker | Folder: Random from folder path |
| include_subfolders | BOOLEAN | false | Include subfolders when scanning in Folder mode |
| seed | INT | 00–18446744073709550000 | Random seed for reproducible selection in Folder mode |
| image_data | STRING | Image reference (temp) from file picker (auto-filled) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |