1f3bfe02eff226404b2c1a34efa33a434a239a1d
- Single image and folder random selection modes - Subfolder scanning support - Resolution output (width/height) - Seed control for reproducible random selection - Support for PNG, JPEG, WebP, BMP, GIF formats
Random Image Picker - ComfyUI Custom Node
A ComfyUI custom node that provides flexible image loading with support for both single file and random folder selection.
Features
- Single Image Mode: Load a specific image file
- Folder Mode: Randomly select an image from a folder
- Subfolder Support: Option to include subfolders in the search
- Resolution Output: Automatically outputs image width and height
- Reproducible Random: Seed control for consistent random selection
Installation
-
Clone or download this repository to your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes git clone <repository-url> Comfyui-Random_Image_Picker -
Restart ComfyUI
Usage
Node Inputs
-
path (STRING):
- In Single mode: Full path to an image file
- In Folder mode: Full path to a folder containing images
-
folder_mode (BOOLEAN):
OFF(Single): Load the specified image fileON(Folder): Randomly select an image from the folder
-
include_subfolders (BOOLEAN):
OFF: Only scan the specified folderON: Include all subfolders in the search
-
seed (INT):
- Random seed for reproducible image selection in Folder mode
- Range: 0 to 18446744073709551615
Node Outputs
- IMAGE: The loaded image in ComfyUI tensor format
- width (INT): Image width in pixels
- height (INT): Image height in pixels
Supported Image Formats
- PNG (.png)
- JPEG (.jpg, .jpeg)
- WebP (.webp)
- BMP (.bmp)
- GIF (.gif)
Examples
Single Image Mode
path: D:/images/photo.png
folder_mode: OFF
include_subfolders: OFF
seed: 0
Loads the specific image at D:/images/photo.png
Random Folder Mode
path: D:/images/
folder_mode: ON
include_subfolders: OFF
seed: 42
Randomly selects one image from D:/images/ (excluding subfolders)
Random with Subfolders
path: D:/images/
folder_mode: ON
include_subfolders: ON
seed: 42
Randomly selects one image from D:/images/ and all its subfolders
Technical Details
- Images are converted to RGB format
- Output tensor format:
[batch, height, width, channels] - Pixel values normalized to 0.0-1.0 range
- Uses PyTorch tensors for ComfyUI compatibility
License
MIT License
Author
Created for ComfyUI
Languages
Python
67.2%
JavaScript
32.8%