Nodes/ComfyUI Civitai MCP/Civitai Load Images from Dir (with Metadata)
ComfyUI Node

Civitai Load Images from Dir (with Metadata)

Load a whole folder of images plus their metadata, ready to re-post

By daceheg·Created 3 months ago·Updated 3 months ago· 6
Civitai Load Images from Dir (with Metadata)
    • images
    • a1111_params
    • workflow_json
    • filenames
    directory
    image_load_cap0
    start_index0

    You've got a folder of renders - a week's worth of generations, a finished set for a contest, an old batch you want on your profile. Stock ComfyUI can load images, but it throws away the embedded generation metadata, so re-posting them properly means manually re-entering every prompt. This node loads every image in a directory and each one's embedded metadata, returning parallel lists purpose-built to feed the Civitai Create Post node in one shot.

    The inputs

    • directory (STRING, required) - an absolute path to the folder. Not relative, not a file picker: a real filesystem path like /home/you/renders/contest.
    • image_load_cap (INT, optional, default 0) - max images to load; 0 means no limit. Use it to avoid loading 2,000 files by accident.
    • start_index (INT, optional, default 0) - skip this many images after sorting by filename. Combined with the cap, that's how you page through a big directory.

    What comes out

    Four outputs, all lists, aligned by index:

    • images - the image tensors.
    • a1111_params - each image's recovered A1111-format parameters string (empty for files with no metadata).
    • workflow_json - each image's embedded ComfyUI workflow (empty entry when absent).
    • filenames - the filename for each entry, so you can tell which is which.

    The whole design is that these wire straight into Civitai Create Post, which is INPUT_IS_LIST-aware: images into its images input, the params and workflow lists into its a1111_params and workflow_json inputs. Because Create Post maps metadata per image by index, every re-posted image keeps its own original prompt and workflow - which is the difference between a useful post and a batch of mystery images.

    How it works

    Files are gathered sorted by filename, filtered to the usual image extensions (.png, .jpg, .jpeg, .webp, .bmp, .gif, .tiff), then sliced by start_index and image_load_cap. For each file, the pack opens it and reads the embedded metadata - the A1111/Civitai parameters string from a PNG text chunk or JPEG EXIF, plus the ComfyUI prompt/workflow chunks. Files without a parameters string but with a ComfyUI prompt graph get one synthesized, mirroring what the single-image loader does. A file that fails to load is skipped with a warning rather than killing the batch.

    Where people get burned

    Two hard errors: if the directory path doesn't exist (or isn't a directory), it raises Directory not found; if nothing loadable survives the filter and slicing, it raises No images found. Both are loud and specific - the fix is usually a typo in the absolute path or a start_index that skips past everything. And remember this node reads what's on disk at run time: if you point it at a folder you're still writing to, you'll get a snapshot, not a live view.

    Installing it

    ComfyUI Manager, search ComfyUI Civitai MCP, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/daceheg/ComfyUI-civitai-mcp.git
    

    Restart after. The pack's only real dependency is requests; loading metadata locally needs no API key, though posting the result does.

    CategoryCivitai-mcp

    Inputs (3)

    NameTypeDefaultDescription
    directorySTRING
    image_load_capoptINT00–4294967295Maximum number of images to load (0 = no limit).
    start_indexoptINT00–4294967295Skip this many images (sorted by filename) before loading.

    Outputs (4)

    NameTypeDescription
    imagesIMAGE
    a1111_paramsSTRING
    workflow_jsonSTRING
    filenamesSTRING