Nodes/ArtyClaw Comfy Nodes/SimpleDirLoader
ComfyUI Node

SimpleDirLoader

Load a Whole Folder of Images as a List, Not One Big Batch

By artyclaw·Created 5 months ago·Updated 5 months ago· 0
SimpleDirLoader
    • image_list
    • path_list
    directory
    limit0

    Most of ComfyUI's image loaders hand you a single image, and the ones that batch tend to stack everything into one tensor. SimpleDirLoader deliberately does neither: it takes an absolute folder path and returns every image in it as a list of individual IMAGE tensors, plus the list of paths. Each image stays its own [1, H, W, C] tensor at its native resolution - which is exactly what you want when downstream nodes are going to iterate images one at a time (img2img a folder, run a control pass per reference, feed a batch-processor).

    It's from artyclaw/artyclaw-comfy. The source is blunt about the design goal: "Load Images from Folder (List Mode)" - and the OUTPUT_IS_LIST = (True, True) flag is the whole trick, telling ComfyUI the outputs are separate list items rather than one batched tensor.

    How it works

    The loader scans the folder for .png, .jpg, .jpeg, .webp, .bmp, and .tiff files, sorts them alphabetically, optionally truncates with limit, and for each file:

    1. Opens it, applies exif_transpose (so phone photos come out the right way up), and converts to RGB.
    2. Normalizes to 0–1 floats.
    3. Wraps it as a [1, H, W, C] tensor - one item per image, no resizing, no torch.cat batching.

    The paths list lines up index-for-index with the images, which is the feature that makes this node genuinely useful: pair it with a sidecar-prompt loader or a filename matcher and you've got a folder-scale dataset pipeline in three nodes.

    Inputs and outputs

    • directory - an absolute path to the image folder (the tooltip says so explicitly).
    • limit (optional) - cap the number of images; 0 means all.

    Outputs: image_list (IMAGE, list) and path_list (STRING, list).

    Install

    ComfyUI Manager → search ArtyClaw Comfy Nodes, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/artyclaw/artyclaw-comfy
    

    Restart. Dependencies are torch, numpy, and Pillow - all standard ComfyUI kit.

    Where people get burned

    The path must be absolute - a relative path raises a FileNotFoundError rather than resolving gracefully, so check that first. Second, if the folder has no matching images, the node raises ValueError("No images found in the specified directory.") and the run fails loudly, which is better than silently doing nothing but can halt a batch you thought was fine. Third, remember the list vs. batch distinction: some downstream nodes expect a single batched tensor and will misbehave with a list, so check what your consumer wants before wiring. And there's a registration quirk worth knowing: the source registers the display name as "Load Images from Folder (List Mode)" under a LoadImages key, but the node shows up as SimpleDirLoader in the pack - if your Manager search is coming up empty, search the pack title instead.

    CategoryCustom/Loading

    Inputs (2)

    NameTypeDefaultDescription
    directorySTRINGAbsolute path to the image folder.
    limitoptINT00–9999Limit number of images (0 = all).

    Outputs (2)

    NameTypeDescription
    image_listIMAGE
    path_listSTRING