Load Image Enhanced
The LoadImage that actually tells you what file it loaded
- image
- mask
- filename
Stock LoadImage is the workhorse of every ComfyUI workflow, and it has one dumb blind spot: it refuses to tell you what file it actually loaded. It hands you the image and the mask and then shrugs. So when you want to name a saved output after its input - hero.png in, hero_edited.png out - you either type the name by hand or wire up a convoluted path-parse chain. LoadImageEnhanced is a drop-in replacement that fixes exactly that one gap, and it does it without touching anything else you already have in your graph.
The pitch is simple: same image dropdown, same IMAGE and MASK outputs, same "image" category, zero extra dependencies. The only addition is a third output, a STRING called filename. Wire that into a Save Image node's filename_prefix and suddenly every output is named after its source image automatically. That alone is worth the install if you batch-process folders of inputs.
How it works
The node is a near-copy of ComfyUI core's load_image, dressed up with three additions. First, the dropdown lists images recursively through your input directory - no more digging through subfolders in the default flat list - while skipping clipspace, 3d, pasted, and anything starting with .. Second, it keeps multi-frame support: animated GIFs and APNGs are iterated frame-by-frame and concatenated into a batched IMAGE output (frames that don't match the first frame's dimensions get dropped). EXIF orientation is applied automatically, and an alpha channel becomes a mask, with a 64x64 zero mask as the fallback - the same behavior stock LoadImage gives you, so no surprises.
The interesting bit is the filename tracking, which works through two things: an original_filename text widget and a small frontend extension. The extension auto-syncs that widget to the selected file's basename whenever you change the dropdown. The filename output then returns whatever's in that widget, not the currently-selected file. That ordering is the whole point. If MaskEditor saves an edited copy to clipspace-painted-xxx.png, the dropdown updates but original_filename stays hero.png - so the filename output keeps saying hero.png. You track where the image came from, not where it currently lives. If the widget is empty, it falls back to the basename of the resolved path.
One genuinely nice touch buried in the code: IS_CHANGED hashes the file on disk, so ComfyUI re-runs the node when the image file itself changes - handy if another node edits the file in place.
The inputs that matter
image- the dropdown. Lists every image underinput/, subfolders included, with the usual upload button.original_filename- the editable text field that drives the filename output. The extension fills it for you; you only touch it when you want to override.
Outputs: image (the tensor), mask (the alpha-derived mask, wired into anything that takes a mask), and filename (the STRING you've been missing).
Installing it
Easiest path is ComfyUI Manager - search for LoadImageEnhanced (or the pack title "ComfyUI-LoadImageEnhanced") and hit install. Or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/yusrmuttaqien/ComfyUI-LoadImageEnhanced
Then restart ComfyUI and it shows up under image. There's no requirements.txt in the repo - it only needs PIL, PyTorch, and NumPy, all of which ComfyUI already ships. No model downloads, no heavy dependencies, no install pain. It's about as low-risk as a custom node gets.
Where people get burned
The filename output can feel like it's lying, but it isn't. It returns the original filename by design. After a MaskEditor round-trip the widget keeps the old name, so if you genuinely want the new clipspace-... name in your saved file, you have to type it into original_filename yourself - the extension won't do it for you.
Second trap: multi-frame GIFs come out as a batch, not a single image. If you feed that into a node expecting one frame, you'll get either a stack or confusion. It's a feature (frame iteration), but it will surprise you the first time.
Third: the 64x64 zero mask when an image has no alpha isn't a bug, it's stock LoadImage behavior - if you're inpainting, make sure your image actually carries an alpha channel or use a proper masking node. And honestly, expect this to be a small solo project with zero real-world chatter around it - the code is clean and works, but don't go hunting for community tutorials, because there aren't any.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | COMBO | 1 options: example.png | |
| original_filename | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | The loaded image tensor. |
| mask | MASK | The image mask (if available). |
| filename | STRING | The original filename of the loaded image. |