Nodes/ComfyUI-Creepy_nodes/Load Batch From Dir (Creepybits)
ComfyUI Node

Load Batch From Dir (Creepybits)

Load a whole folder of images as one batch

By Creepybits·Created about a year ago·Updated 2 months ago· 32
Load Batch From Dir (Creepybits)
    • IMAGE
    • MASK
    • INT
    directory
    image_load_cap0
    start_index0
    load_alwaysfalse
    force_rescanfalse

    When you need every image in a folder as a single IMAGE batch - dataset prep, batch upscaling, captioning a collection - you want this node. Load Batch Images Dir (display name "Load Batch From Dir", so don't get it confused with the pack's one-at-a-time iterator) pulls a folder's worth of images into one stacked tensor, ready for any batch-processing node.

    It's the bulk loader in the pair. The full-batch behavior is the point: one run, everything loaded, downstream nodes process the stack at once. It's also more careful than a bare Image Load would be - it validates every file before loading, skips corrupted images, caches its file list, and handles mixed image sizes by resizing everything to match the first image.

    How it works

    On load it lists the directory, filters to known image extensions (jpg, jpeg, png, webp, jxl, gif, bmp, tiff, ico - including JXL if you have pillow-jxl installed), and runs a PIL verify pass on each candidate, dropping anything that fails. The survivors are sorted alphabetically and cached in memory, keyed by directory and its modification time. New files in the folder are detected automatically because the cache invalidates when the directory's mtime changes.

    Then it loads and stacks. If later images differ in size from the first, they're bilinearly resized to match - which means the output batch is always a clean rectangular tensor, not a ragged mess. Alpha channels become MASK outputs, standard ComfyUI style.

    Inputs that matter

    • directory - where the images live.
    • image_load_cap - max images to load. 0 means load everything valid.
    • start_index - skip the first N alphabetically-sorted images. Handy for resuming after a crash mid-batch.
    • load_always - force a re-run every time (the node's IS_CHANGED returns NaN when this is on). Default false.
    • force_rescan - force re-scanning and re-validating instead of trusting the cache. The mtime check usually makes this unnecessary, but it's there if you've swapped files in place.

    Outputs: IMAGE, MASK, and an INT (the count of images actually loaded).

    Installing it

    It's part of ComfyUI-Creepy_nodes:

    • ComfyUI Manager: search "Creepy_nodes" and install.
    • Manual:
      cd ComfyUI/custom_nodes
      git clone https://github.com/Creepybits/ComfyUI-Creepy_nodes.git
      

    Restart ComfyUI. Requires Pillow (ComfyUI already has it); JXL support is optional via pillow-jxl.

    Troubleshooting

    The big one: this node raises rather than degrades. Empty directory, invalid path, or zero valid images all throw a FileNotFoundError, which bricks the workflow with a red error instead of returning an empty batch. That's actually good for catching mistakes early - but it means you should validate your folder path before wiring this into a long queue.

    Second, mixed-size folders get silently resized. If your collection has a few 4K renders mixed with 512px crops, everything gets squashed to the first file's dimensions, and you may not notice until the output is blurry. Normalize sizes before loading if that matters. And keep an eye on memory: loading 500 full-res images into one batch is a fast way to OOM your VRAM if the downstream node processes them all at once.

    CategoryCreepybits/image

    Inputs (5)

    NameTypeDefaultDescription
    directorySTRING
    image_load_capoptINT0
    start_indexoptINT0-1–18446744073709550000
    load_alwaysoptBOOLEANfalse
    force_rescanoptBOOLEANfalse

    Outputs (3)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK
    INTINT