Load Image Based on Number (Mikey)
Pick one file from a folder, deterministically
- image
- filename
This one's simple in concept and useful in exactly the situations where "just load one image already" turns out to be more annoying than it should be: point it at a folder, hand it a number, and it loads that one file - not a random pick, not the whole directory as a batch, one specific image chosen by whatever number you feed it.
How it works
seed is doing the same job here it does everywhere else in this pack - it's the deterministic index that picks which file comes back. Set it to a fixed value and you get the same image every time; wire it to something incrementing (this pack's own Range Integer node, or ComfyUI's own seed-control widget set to increment) and you walk through the folder one file at a time across runs. That's a pattern this pack leans on repeatedly - using "seed" as a general-purpose deterministic selector, not just a noise seed - and it's worth recognizing once you've spotted it, because it shows up again in Range Float, Range Integer, and Ratio Advanced's preset picker.
The inputs and outputs that matter
image_directory(STRING) - the folder to read from. Just a path, no browsing widget.seed(INT, default 0) - which file to load. The README doesn't document the exact indexing rule (sorted order, modulo folder size, etc.), so treat it as "this number picks a file, and the same number always picks the same file" rather than assuming a specific ordering scheme.image(output) - the loaded image.filename(STRING output) - the name of the file that actually got loaded. Handy for keeping provenance without a separate lookup: wire it straight into SaveMetaData or a caption node and you always know which source image produced which result.
This is distinct from the pack's separate Batch Load Images node (not covered here), which loads a whole folder at once rather than one file by index.
How to install it
Standard Mikey Nodes install - there's no separate package for this one node. ComfyUI Manager: search "Mikey Nodes," install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/bash-j/mikey_nodes
then restart ComfyUI.
Common issues & troubleshooting
The path has to exist where ComfyUI is actually running. This is the big one on anything other than your own desktop. If you're running on a hosted or serverless ComfyUI executor - comfy.icu included - a folder path from your local machine doesn't exist on the server; the images need to already be present inside the execution environment. If you get an empty result or a load error, check that first before assuming the node is broken.
Ordering isn't guaranteed alphabetical. Since the README doesn't spell out how the seed maps to a file, don't assume seed=7 always means "the 7th file alphabetically" across every OS and filesystem. If the mapping matters - say you're stepping through reference frames in order - name your files with zero-padded numeric prefixes (001.png, 002.png, …) so the order is unambiguous regardless of how the node walks the directory.
Empty or missing folder. No files to pick from means nothing useful comes back. Worth a quick sanity check on the path before you queue a run that depends on it, especially inside a loop.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image_directory | STRING | — | |
| seed | INT | 00–18446744073709550000 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| filename | STRING | — |