Load Image With FileName
Load an image and get its name back — the filename strings core Load Image drops
- IMAGE
- MASK
- File Name
- Extension
- Path
ComfyUI's built-in Load Image is a black hole for filenames. You feed it a file, it hands back an IMAGE tensor and a MASK, and the name vanishes into the graph. The moment you want that name - to stick it in a prompt, name a saved output after the input, or keep provenance in metadata - you're typing it by hand or rigging up a batch tool. This node is the tiny fix: a drop-in Load Image that also gives you the file's name, extension, and path as plain strings.
It's exactly what it sounds like. Load Image With FileName is the core Load Image node (same dropdown of files in your input/ folder, same upload button) with three extra STRING outputs bolted on. That's the whole pitch, and for a single-purpose utility that's fine.
How it works
The source is basically core ComfyUI's LoadImage with a filename splitter. It lists images from folder_paths.get_input_directory(), opens the file with PIL (running exif_transpose so phone photos aren't sideways), converts to RGB, and turns the alpha channel into the MASK - same as the built-in node. Then it runs os.path.splitext on the filename: base name becomes File Name, the bit after the dot becomes Extension (no leading period - "png", not ".png"), and the parent directory becomes Path.
Two details in the source are worth knowing. IS_CHANGED sha256-hashes the actual file, so if the file on disk changes between runs, the workflow re-executes - useful for automation that drops a new file into the input folder. And it iterates multi-frame GIFs like core Load Image, stacking frames into a batch tensor. If a frame is a different size it's skipped, which matches core behavior exactly.
No heavy dependencies here. The pack's pyproject.toml declares an empty dependency list; everything it imports (torch, PIL, folder_paths, node_helpers) already ships with ComfyUI. That's rare and pleasant for such a fiddly pack category.
Inputs and outputs that matter
One input, the same as core Load Image: an image picker listing files in your input/ directory, with image upload built in.
- IMAGE - the RGB tensor, wires into any model's image input (img2img, ControlNet, IPAdapter, VAE encode).
- MASK - the inverted alpha channel (white = transparent, matching core behavior); zeros if there's no alpha.
- File Name / Extension / Path - the three STRINGs that are the entire reason this node exists. Wire them into a prompt (via a text-concat node), a save node's naming logic, or a metadata writer.
Why you'd reach for it
The obvious case is keeping filenames alive across a workflow: process photo_001.png, and have the output named after it instead of a timestamp. Batch-captioning pipelines (load an image, caption it, save the caption under the same name) hit this exact wall constantly - that's the top reddit question in this niche. If you're only loading one image at a time, this is the minimal, dependency-free way to do it.
The honest caveat: this niche has company. WAS Node Suite's Load Image Batch handles whole folders and is what most threads recommend, and thalismind's ComfyUI-LoadImageWithFilename is the variant people actually name when the question comes up. HAEGONG's version is the stripped-down single-node option. It does one thing, does it with zero install risk, and if you only need one image plus its name, it's perfectly good.
Install
Via ComfyUI Manager, search ComfyUI_LoadImageWithFileName and install. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/HAEGONG/ComfyUI_LoadImageWithFileName.git
Then restart ComfyUI. No model downloads, no extra pip installs, no venv surgery - the node appears under image in the node menu (or the Basics category in some frontends).
Common issues
- My image isn't in the dropdown - only files in
ComfyUI/input/show up, same as core Load Image. Drop the file there (or use the upload button) and the list refreshes. - File Name looks short - it's deliberately the base name without the extension; the extension gets its own output.
- Path confusion - Path is the directory the file lives in, not the full file path. That's the author's design, and it's what the name says.
It's a one-node pack from a solo author, so updates are slow - but there's so little moving here that there isn't much to break. If you just need the filename to survive your graph, this is the smallest honest tool for it.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | COMBO | 1 options: example.png |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |
| File Name | STRING | — |
| Extension | STRING | — |
| Path | STRING | — |