Nodes/ComfyUI Inspire Pack/Load Image Batch From Dir (Inspire)
ComfyUI Node Runs on cloud

Load Image Batch From Dir (Inspire)

Load a folder as one batch (same-size, stacked)

By ltdrdata·Created 3 years ago·Updated 9 months ago· 805
Load Image Batch From Dir (Inspire)
    • IMAGE
    • MASK
    • INT
    directory
    image_load_cap0
    start_index0
    load_alwaysfalse
    sort_method

    This loads every image in a folder and stacks them into a single batch - one tensor, processed together. That's the difference from the near-identical Load Image List From Dir: batch, not list. Reach for this when you want the images handled as a group in one pass, like feeding a stack of frames into a batched sampler or an animation node that expects a proper batch tensor.

    The catch is baked into the mechanism. A batch tensor requires every image to be the same dimensions, so this node forcibly normalizes every image to the size of the first one it loads. If your folder is all the same resolution, great, nothing to think about. If it's a grab-bag of sizes, they'll get squished or stretched to match image one. The node's code actually comes from Kosinkadink's Advanced-ControlNet loader; the Inspire version is a lightly modified take on it.

    How it works

    It reads the directory, loads the images in your chosen order, resizes them all to match the first, and stacks them into one IMAGE batch. Downstream nodes then process the whole stack at once - which is faster and simpler than list iteration when the nodes support batching, and required when they only accept a batch.

    The inputs and outputs that matter

    • directory - the folder to load. The essential input.
    • image_load_cap - cap on how many images to pull (0 = all).
    • start_index - offset into the file list; skip the first N.
    • sort_method - alphabetical, numerical, or datetime ordering (asc/desc). Numerical sorting is the one to pick for frame sequences named with plain numbers.

    Outputs: IMAGE (the batch), MASK (from alpha), and INT - the count of images loaded, useful for driving batch-size math elsewhere.

    Installing it

    Via ComfyUI Manager: search "Inspire Pack", install, restart. Or clone it:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ltdrdata/ComfyUI-Inspire-Pack
    

    Restart ComfyUI (and pip install -r requirements.txt if you went manual). No model files needed for this one - it's from Dr.Lt.Data's Inspire Pack, a companion to the Impact Pack.

    Where people get tripped up

    The size normalization is the thing that bites. Load a folder of mismatched-resolution images and they all come out warped to the first image's aspect ratio, which is rarely what you wanted and easy to blame on the wrong node. If you need originals preserved, use Load Image List From Dir - it keeps each image at its native size and outputs a list instead. Beyond that it's the usual directory caveat: the path is resolved on the machine running ComfyUI, so a local folder path won't point anywhere on a hosted runner - stage the images somewhere the server can actually read.

    Categoryimage

    Inputs (5)

    NameTypeDefaultDescription
    directorySTRING
    image_load_capoptINT0
    start_indexoptINT0-1–18446744073709550000
    load_alwaysoptBOOLEANfalse
    sort_methodoptCOMBO7 options: None, Alphabetical (ASC), Alphabetical (DESC), Numerical (ASC), Numerical (DESC), Datetime (ASC), +1

    Outputs (3)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK
    INTINT