Nodes/PortraitUtils/Load Image (Combined)
ComfyUI Node

Load Image (Combined)

Load one image or plow through a folder, same node

By heyburns·Created 11 months ago·Updated 4 months ago· 1
Load Image (Combined)
    • IMAGE
    • filename_no_ext
    • output_dir
    • width
    • height
    modeSingle
    input_dir
    output_dir
    pattern*
    strip_trailing_numbersfalse
    repeat_lastfalse
    image

    The ComfyUI stock loader is a single-image tool, and batch pipelines hit the wall fast: you either reload by hand a thousand times or rig up a fragile loop. LoadImageCombined is the pack's "why not both" loader - a mode dropdown switches between Single (pick one file, like the built-in loader) and Batch (automatically advance through a folder on each run). It also hands you the filename and dimensions as outputs, which the stock loader doesn't.

    In Single mode you pick from the image dropdown and get the standard IMAGE out. In Batch mode, you point input_dir at a folder, optionally filter with a glob pattern (default *), and each time the graph runs it loads the next file in sorted order. Two toggles matter here:

    • strip_trailing_numbers - strips (1), (2), etc. from the filename output, which matters if your files are photo (1).jpg and you need a clean base name for downstream naming.
    • repeat_last - when on, the batch holds on the final file instead of looping back to the start. That's the "leave the last frame on screen" behavior that batch QA workflows live on.

    output_dir is an optional second directory you can pass through - the node returns it as an output so downstream savers know where to write. The outputs are IMAGE, filename_no_ext (with or without trailing numbers stripped), output_dir, width, and height. The width/height outputs are surprisingly handy: wire them into a resolution node or a debug log and your batch never silently changes canvas size under you.

    Under the hood it's careful with state: the batch index is persisted so a restart doesn't reset you to file one, and the list is disambiguated by directory + pattern + strip-flag so switching inputs doesn't desync the counter. That persistence is the kind of detail that makes batch runs actually resume instead of restarting.

    Install

    Manager → search "PortraitUtils", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/heyburns/PortraitUtils
    

    Restart. PIL + glob only; no extra deps.

    Common issues

    • Batch loaded the wrong file - check pattern; a stale glob matching files you thought you removed is the classic culprit.
    • It reset to the first file mid-run - the index is per input-directory/pattern combination. Changing either one legitimately restarts the sequence.
    • filename_no_ext has ugly numbers - turn on strip_trailing_numbers. It only affects the filename output, not which file loads.
    • Batch says no images found - input_dir is relative to... wherever you pointed it. Give it an absolute path; the node is literal about it.

    If your workflow is "process this folder of scans," this is the loader that makes it a one-click thing rather than a babysitting job.

    CategoryPortraitUtils/IO

    Inputs (7)

    NameTypeDefaultDescription
    modeCOMBOSingle2 options: Single, Batch
    input_dirSTRING
    output_dirSTRING
    patternSTRING*
    strip_trailing_numbersBOOLEANfalse
    repeat_lastBOOLEANfalse
    imageCOMBO1 options: example.png

    Outputs (5)

    NameTypeDescription
    IMAGEIMAGE
    filename_no_extSTRING
    output_dirSTRING
    widthINT
    heightINT