Nodes/ComfyUI-ZML-Image/ZML_加载图像
ComfyUI Node

ZML_加载图像

The loader that reads text blocks and keeps alpha

By zml-w·Created about a year ago·Updated 2 months ago· 218
ZML_加载图像
    • 图像
    • 文本块
    • Name
    图像
    正规化正规
    读取文本块禁用
    输出透明启用

    ComfyUI's built-in Load Image is fine, but it drops two things you sometimes really need: the alpha channel, and the text that lives inside the PNG. ZML_LoadImage is the pack's answer to both - and honestly, if you use the ZML ecosystem's save node (which writes a "text block" into the file), this is the loader you pair with it.

    The core idea is the ZML "文本块" (text block) convention: when the pack's save node stores your prompt, it writes it into the PNG as a text chunk keyed comfy_text_block. This loader can read that back out. Set 读取文本块 to 启用 (enable), and the 文本块 output returns your saved prompt exactly as it went in - which makes the image + prompt pairing survive re-downloads, re-shares, everything, as long as the PNG bytes aren't re-encoded.

    The other trick is 输出透明 (output alpha), default 启用. The official loader flattens transparency; this one keeps RGBA when the source has it, which matters for compositing, overlays, and any workflow where you're stacking images. Flip it to 禁用 if a downstream node chokes on 4-channel input.

    The 正规化 (normalization) dropdown is a ZML house convention and it's genuinely useful: it controls how the Name output is derived from the filename. 禁用 gives the raw filename, 仅名称 strips the extension, 正规 takes everything before a #-# separator (so girl#-#portrait.pnggirl), and 反向 takes everything after it. This is how the pack lets one image carry a name for your own organization - think of #-# as a poor man's delimiter in filenames.

    So the three outputs: 图像 (the loaded IMAGE), 文本块 (the embedded prompt, or "未读取"/"未找到文本块内容" if there's nothing), and Name (the normalized filename). The image selection is the standard upload dropdown over ComfyUI's input folder, with an image_upload flag so you can drop new files in.

    Where beginners stumble: "读取文本块" says 未找到 even for PNGs that have metadata - because the text block key is ZML-specific. A normal ComfyUI save writes workflow and prompt chunks, not comfy_text_block, so this node only finds text that the ZML save node (or anything using the same key) wrote. It won't reconstruct a graph from a stock ComfyUI PNG. If you want the prompt out of a normal ComfyUI PNG, you need the workflow, not this node - the KB's metadata doc covers that distinction thoroughly.

    One more thing: IS_CHANGED returns float("NaN"), so the node always re-reads the file instead of trusting the cache - that's the "always-rerun" plumbing trick, and it means you can't accidentally get a stale image. It also means this node sits at the head of the cache chain, so don't put heavy work upstream of it.

    Install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/zml-w/ComfyUI-ZML-Image
    

    or via ComfyUI Manager (search "ComfyUI-ZML-Image"), then restart. It's under ZML 图像 → 图像, and the UI is Chinese unless you grab the English translation patch.

    Categoryimage/ZML_图像/图像

    Inputs (4)

    NameTypeDefaultDescription
    图像COMBO1 options: example.png
    正规化COMBO正规4 options: 禁用, 仅名称, 正规, 反向
    读取文本块COMBO禁用2 options: 启用, 禁用
    输出透明COMBO启用2 options: 启用, 禁用

    Outputs (3)

    NameTypeDescription
    图像IMAGE
    文本块STRING
    NameSTRING