Nodes/comfyui-gimp-nodes/Load Mask (GIMP)
ComfyUI Node

Load Mask (GIMP)

Paint a mask in GIMP, inpaint it in ComfyUI

By nchenevey1·Created 2 years ago·Updated 2 years ago· 11
Load Mask (GIMP)
    • MASK
    mask
    width512
    height512

    The sibling node to Load Image (GIMP) - and the one you want when the whole job is masking, not image transfer. Load Mask (GIMP) takes a base64 RGBA blob from the GIMP plugin, rebuilds it, and hands ComfyUI a single MASK tensor. No image output, no fuss. If you're doing a straight inpainting or outpainting pass - "regenerate this area, keep the rest" - this is the cleaner path, because you don't drag a full image through the graph just to get a mask.

    It's part of the same comfyui-gimp-nodes pack (a fork of Acly's comfyui-tooling-nodes, modified to speak raw RGBA instead of PNG), so the installation and the general shape are identical to its sibling. What's different is the masking convention, and that's where people get confused.

    How it works

    The plugin sends your GIMP selection or painted area as an RGBA image. The node base64-decodes, rebuilds it at exactly width × height, and grabs the red channel as the mask. That's the whole mechanism - it does not use the alpha channel, and unlike Load Image (GIMP), it does not invert anything. The red value maps directly to mask intensity: pure red comes out as 1.0 (fully "selected" in ComfyUI's convention), black as 0.0.

    Practical translation: in GIMP, paint the region you want regenerated in red. Fill it with solid red, send it, and ComfyUI sees a white mask over exactly that area.

    The inputs and outputs

    • mask - the base64 RGBA string, filled in automatically by the GIMP plugin. You don't type this.
    • width and height - must match the real dimensions of the incoming blob. Defaults are 512, and mismatches throw Image.frombytes size errors. Same rule as the image-loading sibling.
    • MASK - the only output. Wire it into anything that wants a mask: VAEEncode's mask input in an inpainting setup, SetLatentNoiseMask, a Flux Fill or inpaint-ControlNet workflow, or masking math nodes.

    Installing

    Same as the rest of the pack - ComfyUI Manager, search "comfyui-gimp-nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/nchenevey1/comfyui-gimp-nodes.git
    

    Then restart ComfyUI. No pip dependencies beyond what ComfyUI already ships (PIL, numpy, torch), no model files. Don't forget the other half: the gimp-comfy-tools plugin in GIMP is what actually sends the mask.

    Common issues

    • Your mask comes back all black (empty) - this is the classic trap. You painted the mask in a color with no red in it. A white or black mask fill gives a red channel of ~0, which reads as "nothing selected." Use red, or at least something with a meaningful red component.
    • The mask includes more than you painted - the node takes the red channel of whatever RGBA image the plugin sent. If your source layer has red pixels outside your selection, they show up in the mask. Keep the mask layer clean.
    • Size mismatch errors - width/height don't match the sent blob. Re-send with the right numbers.

    For the narrow job of "paint where to fix, then fix it," this node is the one you'd reach for - it keeps the data pipeline minimal and the mask convention (red = selected) dead simple once you know it.

    Categoryexternal_tooling

    Inputs (3)

    NameTypeDefaultDescription
    maskSTRING
    widthINT5120–8192
    heightINT5120–8192

    Outputs (1)

    NameTypeDescription
    MASKMASK