A custom node for ComfyUI that allows you to load and visually select images directly from a local folder on your computer. It generates a scrollable, interactive image gallery right inside the node interface!
- Visual Selection: Stop guessing filenames. See all images inside a specified directory and pick the one you want by clicking on it.
- Auto-Sorting: Automatically sorts images by modification date (newest first).
- Scrollable Grid: Handles folders with lots of images cleanly via a built-in scrollbar.
- Dynamic Thumbnail Resizing: Use the
preview_sizeslider to scale the thumbnails up or down in real-time without reloading the folder. - Supported Formats: Loads
.png,.jpg,.jpeg,.webp, and.bmp. - Mask Output: Automatically outputs the alpha channel as a mask if the selected image has transparency.
- Navigate to your ComfyUI
custom_nodesdirectory. - Create a new folder named
ComfyUI-FolderGallery. - Place the files inside exactly like this:
ComfyUI/
└── custom_nodes/
└── ComfyUI-FolderGallery/
├── __init__.py
├── node.py
├── README.md
└── js/
└── gallery.js
- Restart ComfyUI completely (close the terminal and start it again).
- Refresh your browser (press F5) to ensure the new JavaScript UI elements are loaded.
- Add the Node: Right-click in the ComfyUI canvas, search for
Folder Gallery Loader, or find it underAdd Node > image > custom > Folder Gallery Loader. - Enter Folder Path: Type or paste the absolute path to your image folder into the
folder_pathinput box (e.g.,C:/Users/Name/Pictures/or/home/user/images/).- Note: Press
Enteror click outside the text box to trigger the loading process.
- Note: Press
- Adjust Size: Use the
preview_sizeslider to change the size of the thumbnails to your liking. - Select an Image: Click on any image in the grid. A green border will appear around it, indicating that it is currently selected.
- Connect and Run: Connect the
IMAGEoutput to your workflow (e.g., to a VAE Encode, ControlNet, or Image Preview) and click Queue Prompt.
folder_path(STRING): The absolute path to the directory containing your images.preview_size(INT): Slider to adjust the CSS size of the thumbnails inside the node (Range: 30 - 300).selected_image(STRING): Hidden. Automatically updated by the UI when you click an image.
IMAGE: The standard ComfyUI image tensor of the selected image.MASK: The alpha channel of the image (outputs a blank mask if no alpha channel exists).
- The gallery is empty / doesn't load: Double-check your folder path. Ensure you have read permissions for that folder. Avoid using quotation marks
"around the path. - The node UI looks broken: Make sure you refreshed your browser. ComfyUI caches JavaScript files heavily. You may need to clear your browser cache (Ctrl+F5).
MIT License