Nodes/ComfyUI-northTools/Load Image list from Directory with indexes
ComfyUI Node

Load Image list from Directory with indexes

Load only the images you pick from a folder — metadata and all

By northumber·Created about a year ago·Updated about a year ago· 4
Load Image list from Directory with indexes
    • IMAGE
    • MASK
    • FILE PATH
    • METADATA
    • INDEX COUNT
    directory
    indices

    LoadImagesFromDirList loads every image in a folder; this node loads only the ones you tell it to. Same family, same outputs, but the loading is filtered through an index string like 0,2,5,8,15 (zero-based, so 0 is the first image alphabetically). Think of it as the "only these, please" version - for when a folder holds a hundred reference images and your workflow only wants the five that survived some earlier filter.

    How it works

    Same machinery as the plain directory loader: list the folder, keep .jpg, .jpeg, .png and .webp, sort alphabetically, then parse the indices string. Each index is checked against the file count - out-of-range values are silently dropped, duplicates collapse, survivors sort - and only the matching files get opened. Images are EXIF-transposed, converted to RGB float tensors, and returned as separate list entries.

    The five outputs mirror LoadImagesFromDirList exactly, all as lists:

    • IMAGE - one entry per selected image.
    • MASK - the alpha channel of each (a zero mask where there's no alpha).
    • FILE PATH - the full path of each selected image, for save or logging nodes.
    • METADATA - each image's embedded PNG text chunks plus EXIF as a stringified Python dict.
    • INDEX COUNT - each image's position in the folder, matching your input indices.

    Because the images come out as a list rather than a stacked batch, they don't need to share dimensions - that's the key difference from LoadImagesFromDirByIndexBatch, which stacks everything with torch.cat and dies on mixed sizes. If your folder has varied resolutions, this is the one you want.

    Inputs

    • directory (required) - absolute path to the folder.
    • indices - the comma-separated position string. Empty or invalid, and the node refuses to run with a "Waiting for valid indices string" exception rather than silently loading nothing.

    Where it fits

    Its natural dance partner is BooleanIndexesToString in the same pack: check each image in a folder somehow, convert the pass/fail list into an index string, and feed it here. You end up with only the relevant images - plus their metadata and paths, which the batch variant doesn't give you. Then ExtractMetadataByKey pulls one field out of each METADATA entry. It's a neat little pipeline that reads like a filter chain: folder → decide → load only the ones that passed.

    Install

    Manager → search "ComfyUI-northTools", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/northumber/ComfyUI-northTools
    

    then restart. No models to download; requirements.txt is just pillow, numpy, torch - all already present in any ComfyUI install.

    The honest assessment: it overlaps heavily with LoadImagesFromDirList plus a filter node, and it's clearly the middle child of the pack. But if you're building the load-by-decision automation this pack is aimed at, having the index filtering built in is genuinely less wiring - and the metadata and file-path outputs make it strictly more informative than the batch version.

    CategorynorthTools

    Inputs (2)

    NameTypeDefaultDescription
    directorySTRING
    indicesoptSTRING

    Outputs (5)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK
    FILE PATHSTRING
    METADATASTRING
    INDEX COUNTINT