Nodes/ComfyUI-Info-Prompt-Toolkit/Image Directory Reader
ComfyUI Node

Image Directory Reader

Batch a whole folder with captions and metadata intact

By kinorax·Created 5 months ago·Updated about a month ago· 2
Image Directory Reader
    • image
    • image_info
    • file_stem
    • caption
    • path_source
    • path
    path_sourceinput
    path.
    image_load_limit0
    start_index0

    Image Directory Reader loads a folder of images - and their sidecar captions and embedded metadata - as aligned lists. Point it at a subdirectory under ComfyUI's input or output, and for every image you get the image itself, its reconstructed image_info (parsed from A1111-style infotext), its extensionless filename, and any same-name .txt caption. Four parallel lists, one node, sorted and sliced reproducibly.

    The problem it solves

    ComfyUI has an ordinary Load Image node, but it's a single-file affair, and batching a whole directory is where people end up building little workflows or reaching for script-heavy packs. If your job is "regenerate a folder of images from their own metadata," or "run a detail pass over 40 crops," or "turn a batch of tagged images into captioned outputs," you need four things per file that Load Image can't give you in one go: the pixels, the metadata, the name, and the caption. That alignment is the whole feature.

    The inputs that matter

    • path_source - input or output, the base directory.
    • path - the relative subdirectory. The combo walks the tree, so you can pick a nested folder without typing.
    • image_load_limit - how many files to load; 0 means unlimited.
    • start_index - the sorted file index to start from, so you can process a folder in reproducible chunks across runs.

    Files are selected after case-insensitive filename sorting, which makes batch selection deterministic - the same folder always yields the same order, which is what you want when results depend on "the first 12 images." The README is explicit about it, and it's a detail batch people usually learn the hard way.

    The outputs, and the gotcha

    Outputs are image, image_info, file_stem, and caption - all as lists - plus pass-through path_source and path (handy for wiring straight into a caption saver).

    The list shape is the gotcha. A list of images isn't a batch; downstream nodes that expect batch tensors will balk, and the pack's own README points this out for its video reader too. Route through the pack's Image List To Batch (or the equivalent) when the next node wants a single batched tensor. Similarly, caption is an empty string for files with no .txt - that's your signal, not an error.

    One more honest note: image_info is reconstructed and normalized from the A1111 infotext. If the images came from outside the pack's ecosystem and their metadata is malformed, the parse can be partial. Check the metadata side with the pack's debug node if things come back blank.

    Installing it

    Part of the ComfyUI-Info-Prompt-Toolkit pack. ComfyUI Manager - search "Info Prompt Toolkit" - or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kinorax/comfyui-info-prompt-toolkit.git
    cd comfyui-info-prompt-toolkit
    pip install -r requirements.txt
    

    Restart ComfyUI. No model downloads. Small single-author pack (GPL-3.0) with a modest footprint - but a directory reader that keeps captions and metadata aligned is one of its most immediately useful nodes.

    CategoryInfo-Prompt-Toolkit/ImageInfo

    Inputs (4)

    NameTypeDefaultDescription
    path_sourceCOMBOinputBase directory for path
    pathCOMBO.Directory path relative to selected base directory
    image_load_limitINT00 = unlimited
    start_indexINT0Sorted file index to start from

    Outputs (6)

    NameTypeDescription
    imageIMAGE
    image_infoIPT-IMAGEINFO
    file_stemSTRING
    captionSTRING
    path_source*
    path*