AI2Go Multi Image Loader Advanced
The multi-image loader with masks — for batch inpaint where each image brings its own mask
- 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
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_modeis 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.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| files_json | STRING | [] | 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_mode | COMBO | off | off = 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_size | INT | 12008–8192 | Size threshold/target in pixels for downscaling. Ignored while downscale_mode is off. |
| output_slots | COMBO | auto | How 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)
| Name | Type | Description |
|---|---|---|
| count | INT | — |
| image_1 | IMAGE | — |
| mask_1 | MASK | — |
| filename_1 | STRING | — |
| image_2 | IMAGE | — |
| mask_2 | MASK | — |
| filename_2 | STRING | — |
| image_3 | IMAGE | — |
| mask_3 | MASK | — |
| filename_3 | STRING | — |
| image_4 | IMAGE | — |
| mask_4 | MASK | — |
| filename_4 | STRING | — |
| image_5 | IMAGE | — |
| mask_5 | MASK | — |
| filename_5 | STRING | — |
| image_6 | IMAGE | — |
| mask_6 | MASK | — |
| filename_6 | STRING | — |
| image_7 | IMAGE | — |
| mask_7 | MASK | — |
| filename_7 | STRING | — |
| image_8 | IMAGE | — |
| mask_8 | MASK | — |
| filename_8 | STRING | — |