Load Image Return Filename
Load Image, but it also hands you the filename
- image
- mask
- filename
It's ComfyUI's Load Image node with one extra output: the filename. That's the whole pitch, and if you've ever wanted to name your saved edits after the source picture, or branch a workflow on which file you loaded, you already know why it's useful. Stock Load Image gives you the image and its mask and then throws the filename away; this one keeps it as a string you can wire onward.
It lives in this Qwen edit pack because batch editing is where filenames matter. When you're running a folder of images through Qwen-Image-Edit and saving results, "keep the original name" is the difference between an organized output folder and 200 files called ComfyUI_00001.png.
How it works
Same loader as always - it reads an image from your ComfyUI input directory, decodes it, and pulls the alpha channel out as a mask. The addition is that it also returns the file's name as a plain STRING output. No processing beyond the normal load; it just doesn't discard the metadata the stock node discards.
The inputs and outputs that matter
Input: image - the file picker, exactly like the standard Load Image widget (it lists what's in your input folder).
Outputs:
- image - the loaded IMAGE, straight into your edit graph.
- mask - the MASK from the image's alpha channel (empty if there's no alpha), same as stock.
- filename - the STRING you came for. Feed it into a Save Image node's prefix, a text concat, or anywhere you want the source name to travel with the result.
Installing it
Ships with the pack. ComfyUI Manager: search Comfyui-QwenEditUtils, install, restart. Or cd ComfyUI/custom_nodes && git clone https://github.com/lrzjason/Comfyui-QwenEditUtils, then restart. No models or dependencies - and note this one lands under the image category, not advanced/conditioning like most of the pack.
Common issues
The filename you get is the base name of the file you loaded, so if you're expecting a full path or an extension-stripped stem, check what actually comes out before you build a Save prefix on it - trim it downstream if you need a specific shape. The image and mask outputs behave like stock Load Image, which means the mask is only meaningful when the source has an alpha channel; load a flat JPEG and the mask is empty, which is normal. Beyond that there's little to trip on - it's the node you didn't know you wanted until you needed the source name to survive a batch edit.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | COMBO | 1 options: example.png |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| filename | STRING | — |