Files
solidlime-Comfyui-Random_Im…/README.md
T
solidlime 1f3bfe02ef Initial implementation of Random Image Picker node
- 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
2026-01-07 20:09:11 +09:00

100 lines
2.2 KiB
Markdown

# 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
1. Clone or download this repository to your ComfyUI custom nodes directory:
```bash
cd ComfyUI/custom_nodes
git clone <repository-url> Comfyui-Random_Image_Picker
```
2. 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 file
- `ON` (Folder): Randomly select an image from the folder
- **include_subfolders** (BOOLEAN):
- `OFF`: Only scan the specified folder
- `ON`: 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