Nodes/ComfyUI-CloudStorage/Load Mask From Cloud
ComfyUI Node

Load Mask From Cloud

Load Mask From Cloud — pull a channel out of a remote image and feed an inpaint

By philipy1219·Created about a year ago·Updated about a year ago· 2
Load Mask From Cloud
    • MASK
    storage_typeoss
    endpoint
    bucket
    file_key
    channelalpha
    regionus-east-1

    Load Mask From Cloud is the specialist of the CloudStorage pack: instead of giving you an image, it downloads an image from an Aliyun OSS or AWS S3 bucket and pulls a single color channel out of it as a MASK. That's it - and it's exactly what you want when the mask for an inpainting pass lives in a bucket alongside your other assets.

    If your inpaint masks are hand-painted PNGs stored in the cloud, this lets a workflow run start-to-finish without you downloading anything by hand. The channel pick is the whole point: it turns one image into a mask you can feed straight into inpainting.

    How it works

    Download the file into memory (via oss2 or boto3), open it with Pillow, force it to RGBA, and extract the channel you selected - alpha, red, green, or blue - scaled to 0–1. One convention detail to remember: for alpha it returns 1 - alpha, so an opaque image gives you an all-zero (nothing-masked) mask, matching how ComfyUI's core Load Image derives masks. The RGB channels are used raw, so a red-channel mask is just the redness of the image - handy for luminance-style region selection, but it won't behave like alpha.

    Inputs that matter

    • storage_type - oss or s3.
    • endpoint - OSS: oss-cn-beijing.aliyuncs.com style (no scheme). S3: optional.
    • bucket - bucket name.
    • file_key - path of the image inside the bucket.
    • channel - alpha (default), red, green, or blue.
    • region - S3 only, defaults to us-east-1.

    The output is a single MASK tensor, which wires into whatever consumes masks - latent mask conditioning, Set Latent Noisy Mask, or the mask input of an inpaint pipeline. Remember the direction: in ComfyUI, mask values of 1 are the region that gets edited, 0 is left alone.

    Credentials

    Like every node in the pack, there are no key widgets - it reads ALIYUN_ACCESS_KEY_ID / ALIYUN_ACCESS_KEY_SECRET (OSS) or AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY (S3) from the environment. Set them where ComfyUI launches and restart. Missing vars raise Missing required environment variables for ....

    Install

    Via ComfyUI Manager (search "ComfyUI-CloudStorage"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/philipy1219/ComfyUI-CloudStorage
    pip install oss2 boto3
    

    Restart, and the nodes appear under the cloud_storage category. No model downloads.

    Common issues

    • Mask comes out all zeros. Almost always the alpha channel on an opaque image - 1 - 255 is zero, so nothing is masked. Check that the source actually has transparency, or switch to an RGB channel.
    • Always reloads. Like the video node, this one returns NaN from IS_CHANGED, so it re-downloads the file on every run rather than caching. Fine for correctness, wasteful if you run the workflow a lot against the same mask.

    Honest take: this is the pack's least-visited node (basically no search traffic), and its usefulness is narrow - remote source images with an alpha channel. If your masks are local, core ComfyUI mask nodes do the same channel math with zero network. Reach for it when the mask genuinely lives in the cloud.

    Categorycloud_storage

    Inputs (6)

    NameTypeDefaultDescription
    storage_typeCOMBOoss2 options: oss, s3
    endpointSTRING
    bucketSTRING
    file_keySTRINGFile path in cloud storage
    channelCOMBOalphaColor channel to use as mask
    regionoptSTRINGus-east-1Region for S3 storage only

    Outputs (1)

    NameTypeDescription
    MASKMASK