💀Image from Folder
Batch-load every image in a directory, sorted and capped
- count
- filepaths
When you need to process a whole folder of images - a contact sheet, a batch upscale, a grid of variations - the first question is always "which files, in what order?" 💀Image from Folder from the S4Tool-Image pack answers it: it scans a directory, filters to image files, sorts them, and hands back a list of paths plus a count. It doesn't load the images themselves - that's a deliberate split you need to understand.
The mechanism is the useful part. The node walks the folder (optionally recursively), keeps only valid image extensions, sorts by filename, modified time, or size, optionally reverses the order, and caps the result at max_images. You get two outputs: the file count and the list of file paths. Then you feed that list into the pack's companion node 💀Image from Folder by Index, which actually loads one image by position. It's a two-node handshake: one enumerates, the other fetches.
The inputs that matter
folder_path- absolute path to the directory. Get this right; it's a plain string, no ComfyUI folder-picker magic.recursive- whether to descend into subfolders (default off).sort_method-filename,modified, orsize. This is how the index order is decided, and it matters more than you'd think when you're iterating a batch.reverse_order- flip the sort, handy for "newest first."max_images- cap at N files (0 = no cap, up to 10000).
Outputs: count (INT) and filepaths (STRING).
Install
Standard pack install:
cd ComfyUI/custom_nodes/
git clone https://github.com/S4MUEL-404/ComfyUI-S4Tool-Image.git
pip install -r ComfyUI-S4Tool-Image/requirements.txt
Or ComfyUI Manager → search "S4Tool-Image" → Install → restart. No models, no downloads.
Gotchas
- Outputs are metadata, not pixels - don't wire
filepathsinto an IMAGE input. This node exists to hand the list to 💀Image from Folder by Index (or a custom loop). - Absolute paths only - relative paths will likely miss. Use the full
/path/to/folder. - Order is deterministic once you set it - pick your
sort_methodonce and the batch order stays stable across runs, which matters for paired processing. - A count of 0 usually means a bad path - check
folder_pathspelling and that the folder exists, before you suspect the node.
It's half of the pack's batch-loading story, and it only makes sense with its partner node. Use them together and you get deterministic, ordered, capped folder iteration without writing Python.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | — | |
| recursive | BOOLEAN | false | — |
| sort_method | COMBO | filename | 3 options: filename, modified, size |
| reverse_order | BOOLEAN | false | — |
| max_images | INT | 00–10000 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| count | INT | — |
| filepaths | STRING | — |