Load Image (With Subfolder)
Stop spelunking through a 400-file dropdown
- IMAGE
- MASK
The core LoadImage node is fine - right up until your input/ folder becomes a landfill. Suddenly you're scrolling a dropdown with four hundred files, squinting at thumbnails, trying to remember which "ref_final_v3 (2).png" you actually meant. This node is a small, surgical fix for exactly that: it's the stock LoadImage with a subfolder field, so you can keep your images organized under input/ and only ever see the ones inside the folder you've picked.
It comes from a tiny single-node pack by GitHub user liangt, and it does one thing. That's the whole pitch. If you batch-generate per project or per job, this is the loader you'll reach for over the core node; if you keep twelve images in input/ forever, it adds nothing and you can skip it.
How it works
The node is basically core LoadImage's load_image with a folder joined in, plus a small custom server endpoint to make the dropdown work. The subfolder string (default "") is joined onto ComfyUI's input directory, so an empty value means "input root" - a drop-in replacement - and anything else is a folder or nested path like jobs/job42/refs.
The interesting bit is the front end. A tiny JS extension replaces the normal image widget: it calls a custom POST /images_in_directory endpoint that globs jpg, jpeg, png, and webp files under input/<subfolder>/, and fills the dropdown with just those. It also adds a "choose file to upload" button that uploads to the current subfolder - which is genuinely nicer than core, where uploads always land in the root.
Under the hood it's the same PIL pipeline you already trust: EXIF transpose, convert to a float RGB tensor, and a MASK output built from the alpha channel (1 - alpha, so white = transparent, same as core). Multi-frame files like GIFs come out as a batched IMAGE. And IS_CHANGED hashes the file bytes, so overwriting an image on disk re-runs the downstream graph without you touching anything.
The pack has no extra dependencies - just torch, PIL, numpy, and aiohttp, all already in ComfyUI. No model downloads, no requirements to fight over.
Inputs and outputs that matter
Only two inputs exist, and you'll touch one of them:
- subfolder - the folder under
input/to browse. Empty = the input root. This is the whole point of the node. - image - a dropdown that only lists what's in the subfolder. The upload button feeds it too.
Outputs are IMAGE and MASK, exactly like core LoadImage. Wire IMAGE into whatever eats an image - VAE encode, img2img, ControlNet preprocessors, IPAdapter - and MASK into inpainting or anything that takes a mask.
Installing it
ComfyUI Manager (the thing that turned custom nodes from a git-clone chore into a button) has it: Manager → Install Custom Nodes → search "comfyui-loadimagewithsubfolder", then restart. Or do it by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/liangt/comfyui-loadimagewithsubfolder
Then restart ComfyUI. No models to place anywhere, no pip install step - the pack ships only what ComfyUI already provides.
Common issues
- "Invalid image file" - this is the one you'll actually hit. It means the subfolder is empty, misspelled, or doesn't exist yet (the README's third screenshot shows exactly this). The dropdown being empty is the tell. Create the folder under
ComfyUI/input/, drop files in, and re-trigger. - You added files but the dropdown didn't update. The list only refetches when the
subfolderfield changes. Toggle it (or type a character and delete it) to force a refresh. - A file is on disk but not listed. It only shows
jpg/jpeg/png/webp, and only relative toinput/- it won't browseoutput/or model folders. The UI endpoint hard-codes the input directory. - The node has no models and no scary dependencies, which is rare enough for custom nodes to be worth stating: install it, restart, done.
For batch work - one folder per job, point this at it, never scroll the dump again - it's quietly excellent. A pack this small rarely gets talked about (the community chatter around it is basically nil), but simple and stable beats popular when it does one job and does it well.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| subfolder | STRING | — | |
| image | COMBO | 0 options: |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |