ComfyUI Node

Load Images

Batch a folder of references into the edit nodes

By nova452·Created 2 months ago·Updated 28 days ago· 453
Load Images
    • image
    • mask
    • filename
    • caption
    directory_path
    start_index0
    cap4

    Load Images reads a whole folder of images off disk and hands them back as a batch, plus their masks, filenames, and captions. In this pack it's the feeder node: the Krea 2 and Ideogram 4 encode/edit nodes each take up to four reference images, and rather than wiring four separate load-image nodes, you point one Load Images at a directory and let it pull the set. The default cap is 4, which is not a coincidence - it matches the four reference slots.

    Every ComfyUI ecosystem eventually grows a batch loader like this (kijai's KJNodes has one, so does the base "Load Image Batch" crowd). This is the pack's own, tuned for the reference-editing workflow it ships around.

    Inputs and outputs

    Three required inputs:

    • directory_path - the folder to read from. A path string; point it at wherever your reference images live.
    • start_index - default 0. Which image in the folder to start from, so you can skip ahead in a large directory.
    • cap - default 4, range 1 to 1024. The maximum number of images to load. Left at 4, it grabs the first four - exactly enough for the four reference slots.

    Four outputs, all lists:

    • image - the loaded images.
    • mask - their masks (alpha channels where present).
    • filename - the file names, handy for captioning or bookkeeping.
    • caption - captions, typically read from sidecar text files alongside the images.

    You wire the image output into the reference inputs of the encode/edit nodes. The other three are there when you need them - the caption output in particular is useful if you keep .txt prompts next to your references.

    Installing it

    ComfyUI Manager: search ComfyUI-Conditioning-Rebalance, install, restart. Or clone:

    cd ComfyUI/custom_nodes
    git clone https://github.com/nova452/ComfyUI-ConditioningKrea2Rebalance.git
    

    Restart ComfyUI. No pip deps, no model files - it just reads from disk.

    Common issues

    Path problems are the usual culprit. directory_path needs to point at a folder ComfyUI can actually reach - on a cloud or containerized setup that's the runner's filesystem, not your laptop's, so an absolute local path from your desktop won't resolve. Mismatched or empty output almost always traces back to a wrong or unreadable path.

    Mind the cap. It defaults to 4 to match the reference slots, but if you've got a folder of 200 images and forget to raise it, you'll only ever see the first four (or whichever four start_index lands you on). Conversely, don't crank it to 1024 and feed a giant batch into a four-slot node - you'll just load a pile of images the edit node can't use.

    The caption output expects sidecar text files to be there; if your folder is images-only, that output will be empty, which is fine - it's not an error, just nothing to read. For the core job - get a handful of references into a Krea 2 or Ideogram 4 edit without a rat's nest of load nodes - this does exactly what it says and nothing fancier.

    Categoryconditioning/utils

    Inputs (3)

    NameTypeDefaultDescription
    directory_pathSTRINGPath to the directory containing images.
    start_indexINT0Index of the first image to load (sorted alphabetically).
    capINT41–1024Number of images to load.

    Outputs (4)

    NameTypeDescription
    imageIMAGE
    maskMASK
    filenameSTRING
    captionSTRING