Nodes/comfyui-easyapi-nodes/Load Mask From Local Path
ComfyUI Node

Load Mask From Local Path

Pull a mask straight off disk, not the input picker

By lldacing·Created 3 years ago·Updated 8 months ago· 96
Load Mask From Local Path
    • MASK
    image_path
    channel

    ComfyUI's built-in mask loader only shows you a dropdown of files already inside input/. LoadMaskFromLocalPath skips the picker entirely - hand it a full filesystem path and a channel to read, and it loads that image from anywhere on disk and hands back a usable MASK.

    How it works

    It reads the image at the path you give it and pulls a single channel out as the mask. Which channel matters:

    • alpha - for an image that actually has a transparency layer; this is the normal case for a real mask file.
    • red / green / blue - for a mask that was saved as a plain grayscale image baked into one color channel, which is a common export shape from tools that don't do alpha channels at all.

    The inputs and outputs that matter

    • image_path (STRING) - the full path to the file. Not relative to ComfyUI's input folder - a genuine filesystem path.
    • channel (enum: alpha, red, green, blue) - which channel becomes the mask.
    • One output: MASK.

    Where you'd actually use it

    The natural pairing is LoadLocalFilePath: list a folder of mask images, then loop the resulting paths through this node (via ListUnWrapper or ForEachOpen) to load each one as a real MASK for compositing or inpainting further down the graph.

    How to install it

    Via ComfyUI Manager: search comfyui-easyapi-nodes, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/lldacing/comfyui-easyapi-nodes.git
    cd comfyui-easyapi-nodes
    pip install -r requirements.txt
    

    Restart ComfyUI. No models needed.

    Common issues & troubleshooting

    Picking alpha on an image with no alpha channel doesn't error - it just gives you a useless mask. Same behavior as ComfyUI's own built-in loader in that situation: you'll typically get back a fully opaque mask, which reads as "the mask came out blank" rather than "wrong channel selected." If a loaded mask looks fully solid or fully empty, checking the channel setting is the first move, not assuming the file itself is bad.

    image_path wants the real path, not a filename. If you're used to the dropdown-based loaders elsewhere in ComfyUI, this is the one habit that trips people moving to this node - it won't resolve a bare filename against the input folder for you.

    It loads any image file, not just ones already shaped like a mask. There's nothing stopping you from pointing this at a full-color photo and pulling out its red channel - sometimes intentional (some pipelines really do encode a mask into one channel of an otherwise normal-looking image), but usually a sign you've pointed it at the wrong file. If the resulting mask looks like a strange grayscale version of a photo rather than a clean black-and-white region, that's the tell.

    CategoryEasyApi/Image

    Inputs (2)

    NameTypeDefaultDescription
    image_pathSTRING
    channelCOMBO4 options: alpha, red, green, blue

    Outputs (1)

    NameTypeDescription
    MASKMASK