加载图片(文件名)
Load an image and also get its filename out — surprisingly handy
- 图像
- 遮罩
- 文件名称
MuyeLoadImage is ComfyUI's stock LoadImage with one addition that sounds trivial and turns out to matter: a third output that hands you the filename as a string. You pick an image (the dropdown lists files in ComfyUI/input/, and you can drag-and-drop to upload, same as stock), and you get back the 图像 (IMAGE), a 遮罩 (MASK), and 文件名称 - the file's basename.
Why does the filename output matter? It's the glue for workflows that need to remember which image they started from. Feed it to a save node's filename field and your outputs keep their source name; wire it to a text writer and you get a manifest of exactly what went through the pipeline; use it to build the path to a same-basename .txt caption sidecar. The KB's image-I/O doc is built around the three-directory convention (input/ for loading, output/ for saving, temp/ for scratch) and the sidecar pattern - and the filename output is what lets a node chain work with that convention instead of hardcoding names.
Mechanically it's a careful reimplementation of the core LoadImage behavior: forces RGB (so an RGBA image comes out without alpha surprises), and produces the mask from the image's alpha channel - inverted, matching ComfyUI's "white = selected" mask convention - or an all-zero mask when there's no alpha. Two nice touches: IS_CHANGED watches the file's mtime, so editing the image on disk re-triggers the run, and it validates that the file exists before executing.
Honestly, if you just need a plain image load, the stock node is fine and this adds nothing. The case for reaching for MuyeLoadImage is specifically the filename output - and once you're wiring save-side naming from source filenames, it's hard to go back. It's also part of a nice loop in this pack: MuyeLoadImage → process → SaveFilesToLocal, where the saved name can carry the source name through.
Install
ComfyUI Manager → search "muye" → install "ComfyUI-Muye-nodes", restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/muyexiuluo/ComfyUI-Muye-nodes
cd ComfyUI-Muye-nodes
pip install -r requirements.txt
then restart. Pure torch + Pillow, both already in ComfyUI - no extra deps. The README's manual block references an older ComfyUI_Muye.git URL; use the -nodes one above. Display name is 加载图片(文件名); if the node's missing, check the console for [Muye] Failed to load module - the pack silently drops modules that fail to import. And if a mask output looks "inverted," remember ComfyUI convention: alpha becomes an inverted mask, so white in the mask = transparent in the original.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | COMBO | 选择或拖拽图片文件 |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| 图像 | IMAGE | — |
| 遮罩 | MASK | — |
| 文件名称 | STRING | — |