Nodes/ComfyUI-JDCN/JDCN_BatchImageLoadFromDir
ComfyUI Node

JDCN_BatchImageLoadFromDir

Load a folder of images as a batch, skipping N frames

By daxcayΒ·Created 2 years agoΒ·Updated about a year agoΒ· 159
JDCN_BatchImageLoadFromDir
    • Images
    • Image_Names
    • Image_Paths
    • Load_Cap
    • Skip_Frame
    • Count
    β—„Directorydirectory pathβ–Ί
    β—„Load_Cap1β–Ί
    β—„Skip_Frame0β–Ί

    JDCN_BatchImageLoadFromDir loads a folder of images as a batch - skipping the first N if you want, capping the total, and handing you the actual IMAGE tensors plus their names and paths. Where the file-list nodes just hand you paths, this one is where the bytes finally enter your graph. It's the natural endpoint of AnyFileList β†’ loader, and it's built for the "load a frame sequence and process it" pattern.

    How it works

    Three inputs:

    • Directory - the folder to scan.
    • Load_Cap - how many images to load (default 1).
    • Skip_Frame - skip the first N images before loading (default 0).

    Under the hood it walks the folder and grabs every file matching the pack's giant built-in image extension list (jpg, png, webp, tiff, raw, the lot), converts each to RGB, and returns a list of IMAGE tensors. Then it slices by Skip_Frame and Load_Cap: Load_Cap = 0-ish edge case aside, you get file_paths[skip : skip + load].

    Six outputs, but you'll mostly touch three:

    • Images - the loaded tensors (a list of IMAGE).
    • Image_Names - filenames without extensions.
    • Image_Paths - the full paths of what actually loaded.
    • Load_Cap, Skip_Frame, Count - echoes and the final count.

    The two gotchas that matter

    Order is not sorted. The folder walk uses OS order, same as AnyFileList. For a frame sequence frame1, frame2, ... frame10, that's likely not the order you'd expect on Linux. Zero-pad your filenames so OS order matches numeric order, or you'll be feeding shuffled frames into your pipeline.

    Each image is its own tensor in a list. Downstream, whatever consumes Images needs to handle a list of IMAGEs, not one batched IMAGE. If your processor wants a single batched tensor, you'll need a batch/stack step in between. If the node's default Load_Cap = 1 surprises you by loading one image - that's the default, raise it.

    When you'd reach for it

    Frame-sequence batch img2img, batch upscaling, or any "process every frame of this folder" job. Pair the skip math with JDCN_BatchCounterAdvance's SkipFrame output for chunked processing with overlap, which is exactly what that counter was designed to feed.

    Installing it

    Part of ComfyUI-JDCN:

    • ComfyUI Manager β†’ Install Custom Node β†’ search JDCN β†’ install ComfyUI-JDCN β†’ restart.
    • Or:
    cd ComfyUI/custom_nodes
    git clone https://github.com/daxcay/ComfyUI-JDCN.git
    cd ComfyUI-JDCN
    pip install -r requirements.txt
    

    Restart; under πŸ”΅ JDCN πŸ”΅. The pack depends on piexif; image loading uses Pillow, which ComfyUI already ships.

    Common issues

    Bad Directory β†’ empty everything (watch the console log). Images that fail to open (corrupt files, weird formats) are skipped with a console error rather than crashing the batch - good, but it means Count may be lower than the folder's file count. And if colors look wrong, remember everything is force-converted to RGB; transparent PNGs and CMYK files get flattened. If you need a specific slice of a huge sequence, raise Skip_Frame rather than pointing it at the whole folder.

    CategoryπŸ”΅ JDCN πŸ”΅

    Inputs (3)

    NameTypeDefaultDescription
    DirectorySTRINGdirectory pathβ€”
    Load_CapINT11–9999β€”
    Skip_FrameINT00–9999β€”

    Outputs (6)

    NameTypeDescription
    ImagesIMAGEβ€”
    Image_NamesSTRINGβ€”
    Image_PathsSTRINGβ€”
    Load_CapINTβ€”
    Skip_FrameINTβ€”
    CountINTβ€”