Nodes/ComfyUI S4Tool Image/💀Image from Folder
ComfyUI Node

💀Image from Folder

Batch-load every image in a directory, sorted and capped

By S4MUEL-404·Created about a year ago·Updated 10 months ago· 4
💀Image from Folder
    • count
    • filepaths
    folder_path
    recursivefalse
    sort_methodfilename
    reverse_orderfalse
    max_images0

    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, or size. 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 filepaths into 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_method once and the batch order stays stable across runs, which matters for paired processing.
    • A count of 0 usually means a bad path - check folder_path spelling 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.

    Category💀S4Tool

    Inputs (5)

    NameTypeDefaultDescription
    folder_pathSTRING
    recursiveBOOLEANfalse
    sort_methodCOMBOfilename3 options: filename, modified, size
    reverse_orderBOOLEANfalse
    max_imagesINT00–10000

    Outputs (2)

    NameTypeDescription
    countINT
    filepathsSTRING