Nodes/ComfyUI-JDCN/JDCN_BatchImageLoadFromList
ComfyUI Node

JDCN_BatchImageLoadFromList

Page through an image path list in batches

By daxcayΒ·Created 2 years agoΒ·Updated about a year agoΒ· 159
JDCN_BatchImageLoadFromList
    • Images
    • ImageNames
    • ImagePaths
    • Index
    β—„PathListβ€”β–Ί
    β—„Index1β–Ί
    β—„BatchSize5β–Ί
    β—„BatchDirectionβ–Ύβ–Ί

    JDCN_BatchImageLoadFromList is the "page through a list" version of the image loader: instead of scanning a folder itself, it takes a list of paths from somewhere else - JDCN_AnyFileList, a text file, another pack - and loads them in batches, one batch per queue run. If you have 200 images and want to process them 10 at a time across 20 runs, this is the node that turns "a big list" into "the next chunk."

    How it works

    Four inputs:

    • PathList - the paths to load from (list-input).
    • Index - which batch to load, 1-based. This is the key mental shift: Index is a page number, not an element offset. With BatchSize = 5, Index = 1 loads items 1–5, Index = 2 loads 6–10. Bump Index, re-queue, get the next page.
    • BatchSize - items per batch.
    • BatchDirection - TOPTOBOTTOM (front to back), BOTTOMTOTOP (back to front), or RANDOM (random sample of BatchSize from the list).

    Outputs: Images (the loaded tensors), ImageNames, ImagePaths (for exactly the items in this batch), and Index echoed back.

    How to use it

    The intended loop is the standard "chunked processing" pattern:

    1. JDCN_AnyFileList scans your folder β†’ PathList.
    2. Feed PathList into JDCN_BatchImageLoadFromList with your BatchSize.
    3. Queue with Index = 1, then 2, then 3 - each run loads the next slice of the list.
    4. ImageNames/ImagePaths let downstream nodes name outputs per batch.

    RANDOM direction is a nice touch - random BatchSize-sized slices of your list, handy for variation runs where you don't care about order.

    Two honest notes

    The loaders expect paths to be real, loadable images. Unlike the path-listing nodes, this one actually opens the files - bad paths get skipped with a console error. And like BatchImageLoadFromDir, each image comes back as its own tensor in a list, so downstream consumers need to handle a list of IMAGE, not a single stacked batch.

    Also, Index interacts with BatchSize in the paginated way described above - if you read "Index" as a per-element offset you'll get confused. The pack's own documentation hammers this exact point with the a/b/c/d example: Index = 2, BatchSize = 2 over a 4-element list returns c and d, not b and c.

    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 πŸ”΅. Only dependency is piexif, no models.

    Common issues

    An Index past the end of the list returns an empty batch rather than an error - if you see "no images," check whether you've paged past the last chunk. BatchSize = 0 is accepted by the schema but selects nothing meaningful, so keep it β‰₯ 1. And if you're pointing it at a PathList that came from a text file, make sure that list is actually a list of paths, one per line - a common copy-paste failure is feeding it raw filenames with no directory prefix.

    CategoryπŸ”΅ JDCN πŸ”΅

    Inputs (4)

    NameTypeDefaultDescription
    PathListSTRINGβ€”
    IndexINT11–9999β€”
    BatchSizeINT50–9999β€”
    BatchDirectionCOMBO3 options: TOPTOBOTTOM, BOTTOMTOTOP, RANDOM

    Outputs (4)

    NameTypeDescription
    ImagesIMAGEβ€”
    ImageNamesSTRINGβ€”
    ImagePathsSTRINGβ€”
    IndexINTβ€”