Nodes/ComfyUI-ZhiHui/🪣 智绘_增强加载器 (带文件名)
ComfyUI Node

🪣 智绘_增强加载器 (带文件名)

LoadImage that hands you the filename — and a mask you'll want to double-check

By zhuyungen·Created 8 months ago·Updated 4 months ago· 0
🪣 智绘_增强加载器 (带文件名)
    • image
    • mask
    • filename_text
    • filename_stem
    ◄image▾►

    ComfyUI's stock LoadImage gives you an image and a mask, then silently drops the filename. That's the whole gap this node fills: ZH_LoadImagePlus ("🪣 智绘_增强加载器 (带文件名)") is LoadImage plus the filename, on purpose. It's the kind of node you reach for the moment you want saved outputs to keep the source image's name - think batch retouching, img2img where the output should mirror the input filename, or any pipeline where "which file produced this" matters later.

    It comes from ComfyUI-ZhiHui, a Chinese-language utility pack that's essentially unknown in the English community. The core is a faithful copy of ComfyUI's native loader logic - which is good, because that logic is battle-tested - with the filename and mask surfaced as outputs.

    How it works

    You pick a file from the dropdown (it lists the ComfyUI/input folder and supports uploads, same as native LoadImage). Internally it opens the image, applies EXIF orientation so phone photos load the right way up, converts to RGB, and returns four things:

    • image - the RGB tensor, exactly what you'd get from the core node.
    • mask - here's where it gets interesting. If the image has an alpha channel, the mask is the inverted alpha: transparent areas come out white, opaque areas black. The author's own docs frame it as "white = keep, black = remove," but that's an unusual convention for ComfyUI masks, where white usually marks the region being edited. So: don't assume - actually look at your mask in a preview node before feeding it into an inpaint or composite.
    • filename_text - the full name, e.g. photo.png.
    • filename_stem - without the extension, photo.

    If the image has no alpha channel, the mask output is a 64×64 all-black default - it's a placeholder, not a real mask, so don't wire it anywhere that assumes real geometry.

    Why the filename outputs are the point

    Plug filename_stem into the prefix of a save node (this pack's ZH_SaveImagePlus is built for exactly that hand-off) and your pipeline keeps names consistent end to end: load photo.png, process it, save photo.png back out instead of Image_00001.png. That one habit saves hours of renaming across a batch.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/zhuyungen/ComfyUI-ZhiHui.git
    

    Restart ComfyUI. Base deps only (torch, numpy, Pillow), no models. ComfyUI Manager search "ComfyUI-ZhiHui" also works.

    Where people get burned

    The mask convention is the trap - inverted alpha is not the standard "white = what you edit" reading, so test it before you trust it. Second, everything must live in input/; it doesn't read arbitrary OS paths the way the pack's folder loaders do. And a small thing: unlike native LoadImage, there's no mask-preprocessing step, so RGBA PNGs keep their raw alpha behavior rather than ComfyUI's usual white-as-alpha handling. Fine for simple loads, worth knowing if you came from a workflow built around core's masking quirks.

    Category智绘灵箱/图片

    Inputs (1)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png

    Outputs (4)

    NameTypeDescription
    imageIMAGE—
    maskMASK—
    filename_textSTRING—
    filename_stemSTRING—