Nodes/ComfyUI-ZML-Image/ZML_智能加载图像 (子工作流)
ComfyUI Node

ZML_智能加载图像 (子工作流)

Accept a path, a tensor, or the {{图像}} placeholder

By zml-w·Created about a year ago·Updated 2 months ago· 218
ZML_智能加载图像 (子工作流)
    • IMAGE
    • MASK
    图像{{图像}}

    ZML_SubflowLoadImage is the input-side of the pack's subflow trio, and it's the one with an actual trick up its sleeve: it accepts three different kinds of "image" and figures out which one you gave it. Feed it an already-loaded tensor and it passes it straight through with a blank mask. Feed it a file path string and it loads the file from disk like a normal LoadImage, reading the alpha channel into a mask. Or leave it at its default {{图像}} - the placeholder string ComfyUI uses for subgraph input ports - and it acts as the entry point for an image coming into the subflow from outside.

    That polymorphism is what makes it "smart" in the name: one node, three input modes, and it detects which one applies at runtime instead of making you pick.

    Inputs and outputs

    • 图像 (required, STRING) - the clever bit. It's typed as a string with the default {{图像}}, but at runtime it checks what it actually received. A tensor input is passed through (with an all-zeros mask, since the image already has one or doesn't need it); a string that isn't the placeholder is treated as a file path, loaded from the input directory or as an absolute path.

    Outputs are IMAGE and MASK. The mask comes from the alpha channel when the file has one (inverted so 1 = transparent, matching ComfyUI's convention); a file with no alpha gets a small empty mask. That means cutout PNGs loaded through here come out with a usable mask for compositing or inpainting.

    Where it fits

    Use this where the pack's export nodes go on the exit: the entrance to a subflow, wired so the subflow can be fed either by the outer graph directly or by a path from a folder-based workflow. The {{图像}} default is the ComfyUI subgraph idiom - when you drop this into a subgraph and connect an outer image to the subgraph's input port, the placeholder gets resolved and the node becomes the pass-through.

    The honest caveats: it's one of the newer, less-used corners of the pack, so treat it as "works for the common cases" rather than exhaustively tested. And if you feed it a path to a non-image or a missing file, it'll raise rather than quietly fail - check your paths.

    Install

    ComfyUI Manager → search "ComfyUI-ZML-Image", or cd ComfyUI/custom_nodes && git clone https://github.com/zml-w/ComfyUI-ZML-Image, restart. Displayed as ZML_智能加载图像 (子工作流) in the Chinese-default UI; the English patch translates it. No models or extra downloads.

    Categoryimage/ZML_图像/子工作流

    Inputs (1)

    NameTypeDefaultDescription
    图像STRING{{图像}}

    Outputs (2)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK