Nodes/GraftingRayman/GR Mask Create
ComfyUI Node

GR Mask Create

A mask sized and positioned by percentage

By GraftingRayman·Created 2 years ago·Updated about a month ago· 76
GR Mask Create
    • MASK
    height
    width
    mask_width
    position_percentage

    The simplest of the pack's several mask generators, and worth knowing about specifically because it works in percentages rather than pixels. Everything else about mask placement in this pack - GR Mask, GR Multi Mask Create - asks for absolute pixel widths and offsets. This one asks "how much of the canvas" and "where along it," which is the more useful frame when the same mask logic needs to work across images of different sizes.

    How it works

    Set a canvas size with height/width, then describe the masked region as two fractions: mask_width (0–1) is how much of the canvas width the mask covers, and position_percentage (0–1) is where along the canvas it's centered - 0 toward one edge, 1 toward the other, 0.5 centered. Because both controls are expressed as fractions of the canvas rather than fixed pixels, the same settings scale correctly whether you're running this at 512px or 2048px wide, which is exactly what breaks with pixel-based masks the moment your source resolution changes.

    With only a width control and no separate height control, this reads as a band-style mask - a region spanning the canvas that's wide (as a fraction of total width) and positioned along that axis, rather than a freely-sized rectangle you place in two dimensions like GR Mask offers. That makes it a natural fit for wipe-style transitions, gradient-adjacent masking, or any case where you want a masked strip that scales cleanly with the image rather than one sized in fixed pixels you'd have to recompute by hand.

    The inputs and outputs that matter

    • height / width - the canvas dimensions, in pixels, that the percentages below are calculated against.
    • mask_width (FLOAT, 01) - the masked region's width as a fraction of the canvas.
    • position_percentage (FLOAT, 01) - where that region sits along the canvas, as a fraction from one edge to the other.
    • MASK (output) - wire straight into an inpaint, composite, or blend node.

    How to install it

    Via ComfyUI Manager: search "GraftingRayman", install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/GraftingRayman/ComfyUI_GraftingRayman
    

    then restart. Every node in this pack, including this one, needs OpenAI's CLIP package installed on top of ComfyUI's own CLIP handling:

    # portable build
    .\python_embeded\python.exe -m pip install git+https://github.com/openai/CLIP.git
    
    # system python
    pip install git+https://github.com/openai/CLIP.git
    

    Common issues & troubleshooting

    Node missing from search. Check the CLIP install above first - it applies pack-wide, not just to masking nodes.

    Mask position looks off from what you expected. Because position_percentage is a fraction of the full canvas rather than a pixel offset, doubling your canvas width without changing the percentage will double the actual pixel offset too - that's expected behavior, not a bug, but worth remembering if you're porting settings between differently-sized workflows.

    You need a mask sized in both dimensions independently. This node only takes a width fraction, not a height fraction - if you need explicit control over both axes and a shape choice (circle, square, etc.), reach for GR Mask instead, which trades the percentage-based scaling for full pixel and shape control.

    CategoryGraftingRayman/Mask

    Inputs (4)

    NameTypeDefaultDescription
    heightINT
    widthINT
    mask_widthFLOAT0–1
    position_percentageFLOAT0–1

    Outputs (1)

    NameTypeDescription
    MASKMASK