Nodes/ComfyUI-AI2Go-Utils/AI2Go Multi Image Loader Advanced
ComfyUI Node

AI2Go Multi Image Loader Advanced

The multi-image loader with masks — for batch inpaint where each image brings its own mask

By Little-God1983·Created 2 months ago·Updated 4 days ago· 2
AI2Go Multi Image Loader Advanced
    • count
    • image_1
    • mask_1
    • filename_1
    • image_2
    • mask_2
    • filename_2
    • image_3
    • mask_3
    • filename_3
    • image_4
    • mask_4
    • filename_4
    • image_5
    • mask_5
    • filename_5
    • image_6
    • mask_6
    • filename_6
    • image_7
    • mask_7
    • filename_7
    • image_8
    • mask_8
    • filename_8
    files_json[]
    downscale_modeoff
    max_size1200
    output_slotsauto

    The AI2Go Multi Image Loader plus two extra outputs per file: mask_N and filename_N. Same drop-up-to-eight-images node, same downscaling controls - you're gaining a mask and a name for every image you load.

    The mask is why this variant exists. Inpainting in ComfyUI wants an image and a mask, and when you're processing several images that each have their own alpha channel, the plain loader can't help - you'd be extracting masks separately for every file. Here the mask comes out of the box, with stock LoadImage semantics exactly:

    • Mask = 1.0 - alpha (inverted alpha), so the transparent parts of a PNG are the masked areas.
    • A file with no alpha channel yields the stock 64×64 empty mask placeholder - nothing to inpaint, same as LoadImage.
    • When you downscale, the mask is resized with its image, so they never drift apart.

    That last one matters more than it sounds: batch inpaint only works if every mask lines up with its image, and this node guarantees it because it resizes both from the same geometry.

    filename_N is the bare filename string per file, for the same bookkeeping/conditional uses as the audio Advanced variant - label your outputs, branch on which file loaded.

    Everything else is shared

    downscale_mode and max_size behave identically to the basic loader: off (default) passes images through untouched; keep aspect ratio / crop to square shrink only (never upscale); stretch to square forces a square and may enlarge the shorter side. output_slots defaults to auto and can be pinned so wires survive file-list edits. And the off-toggle rule is unchanged: a switched-off row keeps its socket position but emits None on image_N, mask_N, and filename_N - safe for OPTIONAL inputs, a guaranteed failure for REQUIRED ones. count = enabled rows actually emitted.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/Little-God1983/ComfyUI-AI2Go-Utils
    

    Restart ComfyUI, or install through Manager ("ComfyUI-AI2Go-Utils"). No extra dependencies beyond what ComfyUI ships. One thing to know before you build a workflow on it: the repo is frozen at v1.6.1 with issues closed; the author's ongoing work lives at ComfyUI-IntoTheLatent-Utils under renamed ITL* nodes. This pack still works fine for legacy graphs.

    Troubleshooting

    • Mask is all zeros / nothing inpaints: the source images have no alpha channel. This is faithful to stock LoadImage - add transparency to the PNGs (or don't rely on per-image alpha and mask elsewhere in the graph).
    • "not found in the input folder - re-add it": the file moved or was deleted from input/. Re-drop it.
    • Unexpectedly small images: downscale_mode is on - it only ever shrinks.

    If your batch pipeline feeds each image plus its own mask into the same inpaint branch, this is the node to grab. The mask-follows-image guarantee is the part you'd otherwise be debugging at 2 a.m.

    CategoryAI2Go/image

    Inputs (4)

    NameTypeDefaultDescription
    files_jsonSTRING[]Authoritative file list as JSON. Hidden in the UI and kept in sync by the front-end — drop files onto the node instead of editing this.
    downscale_modeCOMBOoffoff = images pass through untouched. keep aspect ratio = shrink keeping shape so the longest edge is max_size. crop to square = centered square, at most max_size. stretch to square = force a max_size square (ignores shape). Never upscales (keep aspect ratio/crop to square); masks follow their image.
    max_sizeINT12008–8192Size threshold/target in pixels for downscaling. Ignored while downscale_mode is off.
    output_slotsCOMBOautoHow many output sockets to show. 'auto' follows the number of loaded files, so sockets appear and disappear as you edit the list. Pick a fixed number to keep the sockets (and your wires) in place while you swap files around — extra sockets with no file behind them output nothing, so don't wire more than you load.

    Outputs (25)

    NameTypeDescription
    countINT
    image_1IMAGE
    mask_1MASK
    filename_1STRING
    image_2IMAGE
    mask_2MASK
    filename_2STRING
    image_3IMAGE
    mask_3MASK
    filename_3STRING
    image_4IMAGE
    mask_4MASK
    filename_4STRING
    image_5IMAGE
    mask_5MASK
    filename_5STRING
    image_6IMAGE
    mask_6MASK
    filename_6STRING
    image_7IMAGE
    mask_7MASK
    filename_7STRING
    image_8IMAGE
    mask_8MASK
    filename_8STRING