Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation


ComfyUI Folder Gallery

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!

✨ Features

  • 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_size slider 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.

📦 Installation

  1. Navigate to your ComfyUI custom_nodes directory.
  2. Create a new folder named ComfyUI-FolderGallery.
  3. Place the files inside exactly like this:
ComfyUI/
└── custom_nodes/
    └── ComfyUI-FolderGallery/
        ├── __init__.py
        ├── node.py
        ├── README.md
        └── js/
            └── gallery.js
  1. Restart ComfyUI completely (close the terminal and start it again).
  2. Refresh your browser (press F5) to ensure the new JavaScript UI elements are loaded.

🚀 Usage

  1. Add the Node: Right-click in the ComfyUI canvas, search for Folder Gallery Loader, or find it under Add Node > image > custom > Folder Gallery Loader.
  2. Enter Folder Path: Type or paste the absolute path to your image folder into the folder_path input box (e.g., C:/Users/Name/Pictures/ or /home/user/images/).
    • Note: Press Enter or click outside the text box to trigger the loading process.
  3. Adjust Size: Use the preview_size slider to change the size of the thumbnails to your liking.
  4. Select an Image: Click on any image in the grid. A green border will appear around it, indicating that it is currently selected.
  5. Connect and Run: Connect the IMAGE output to your workflow (e.g., to a VAE Encode, ControlNet, or Image Preview) and click Queue Prompt.

⚙️ Inputs & Outputs

Inputs

  • 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.

Outputs

  • 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).

⚠️ Troubleshooting

  • 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).

License

MIT License

About

ComfyUI-FolderGallery

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages