Nodes/Gprompts/Batch Image Loader
ComfyUI Node

Batch Image Loader

Load a whole folder into your graph, one image at a time

By GadzoinksOfficial·Created about a year ago·Updated 3 months ago· 3
Batch Image Loader
    • image
    • filename_text
    • width
    • height
    • prompt
    mode
    seed0
    index0
    path
    pattern*
    allow_RGBA_output
    filename_text_extension
    load_exif

    The stock Load Image node is the most predictable thing in ComfyUI: you point it at one file, you get one image, forever. Batch Image Loader is what you swap in when "the file" is actually "one of a hundred files." It reads a folder, picks an image by a mode you choose, and hands it to your graph like nothing happened - same IMAGE output, same wiring. It ships in the Gprompts pack and it's a reworked fork of the WAS node suite's LoadImagesBatch, so the bones are battle-tested even if the pack itself is a small one.

    Why you'd reach for it

    Three workflows, roughly:

    • Re-render an old batch. You have a folder of SD 1.5-era outputs and a new model. Drop this node in, set mode to incremental_image, queue up, and each run feeds the next image into img2img. No babysitting.
    • Reference-library assembly. The prompt-engineering crowd builds "same person, many cameras" sets by batching - this node is the mechanical half of that if your inputs live as files.
    • Batch processor pipelines. Any graph where the input should advance on its own instead of you editing a path widget.

    How it works

    It globs path with pattern, sorts the matches, and lets mode decide:

    • single_image - takes index, wraps around if you go past the end.
    • incremental_image - keeps a counter per (folder, pattern) and advances one file every execution, wrapping when it runs out. This is the one that makes "queue 40, get 40 different images" work.
    • random - seeded by seed, so the same seed gives you the same pick while you're testing, and different seeds sweep the folder.

    There's a subtlety worth knowing: incremental_image and random report themselves as always changed to ComfyUI, which is exactly why the counter advances and random actually re-picks on every run instead of caching one result. single_image, by contrast, hashes the chosen file and only re-executes when it changes.

    The inputs and outputs that matter

    You'll set mode, path (a full folder path - it does not resolve ComfyUI's input/ shortcut the way the stock loader does), and pattern (a glob, * for everything). index matters for single_image, seed for random. allow_RGBA_output - set it to true if your pipeline legitimately needs alpha; otherwise RGBA images get flattened to RGB (or any non-RGB mode gets converted) so the tensor downstream doesn't explode.

    The outputs are the interesting part. Besides image you get filename_text, width, height, and - the one that makes this pack cohere - prompt. When load_exif is on, the loader reads PNG text chunks and returns the embedded computed_prompt from any image saved by this pack's Save Image With Notes node. Save with a computed prompt, reload it later, and the prompt comes back out on its own output instead of you excavating it from the workflow JSON. It'll even try to pull a Positive_Prompt from a CLIPTextEncode node titled "pos" or "positive" in the embedded workflow.

    Install

    It's one of four nodes in the Gprompts pack, so install the pack once:

    cd ComfyUI/custom_nodes
    git clone https://github.com/GadzoinksOfficial/comfyui_gprompts
    

    then restart ComfyUI. Or open ComfyUI Manager → Install Custom Nodes and search "Gprompts" - either way works, and Manager is the path most people should take. The only declared dependency is pillow, which ComfyUI already ships, so there's nothing extra to pip install and no model files to hunt down. It's MIT.

    Where people get burned

    • Path must exist. The node raises Path does not exist and No images found in ... with pattern ... - it does not silently return a black frame, so the error message is honest, but it's on you to type the absolute path correctly.
    • The prompt output is usually empty unless the image was saved by a node that embeds computed_prompt metadata (this pack's Save Image With Notes does). Don't wire it up and expect A1111-style PNGinfo to come out - most of it is stripped or unlabeled.
    • The incremental counter lives on the node instance. Reload the workflow and it resets to the top of the folder. Fine for one batch; annoying if you thought it would remember where it stopped.
    CategoryImage/Loaders

    Inputs (8)

    NameTypeDefaultDescription
    modeCOMBO3 options: single_image, incremental_image, random
    seedINT00–18446744073709550000
    indexINT00–150000
    pathSTRING
    patternSTRING*
    allow_RGBA_outputCOMBO2 options: false, true
    filename_text_extensionoptCOMBO2 options: true, false
    load_exifoptCOMBO2 options: true, false

    Outputs (5)

    NameTypeDescription
    imageIMAGE
    filename_textSTRING
    widthINT
    heightINT
    promptSTRING