A custom node for ComfyUI that loads a random image from a specified folder and outputs it in the standard ComfyUI IMAGE format, along with a MASK and the image path as STRING. Images are loaded in their original dimensions.
A custom node for ComfyUI that loads a random image from a specified folder and outputs it in the standard ComfyUI IMAGE
format, along with a MASK
and the image path as STRING
. Images are loaded in their original dimensions.
.jpg
, .jpeg
, .png
, .gif
, .webp
image
: Tensor of the loaded imagemask
: Alpha channel mask (if present)image_path
: Path to the selected imagecustom_nodes
folder:
git clone https://github.com/yourusername/comfyui-random-image-loader.git
cd comfyui-random-image-loader
pip install -r requirements.txt
Add the "Load Random Image" node from the zverovboy category in ComfyUI. Set the folder path to your image directory. Optionally enable include_subfolders.
init.py: Required for ComfyUI to recognize the custom node module. nodes.py: Contains the node implementation. requirements.txt: Lists dependencies.
Python 3.8+ PyTorch Pillow NumPy