Nodes/ComfyUI-Addoor/🌻 Draw Simple Rectangle
ComfyUI Node

🌻 Draw Simple Rectangle

Make a shape and a matching mask in one node

By Eagle-CN·Created 2 years ago·Updated about a year ago· 75
🌻 Draw Simple Rectangle
    • IMAGE
    • MASK
    width512
    height512
    left50
    top50
    right50
    bottom50
    radius20
    fill_red255
    fill_green255
    fill_blue255
    fill_alpha1.00
    SSAA4
    method

    Draws a rounded rectangle on a blank canvas and hands you both the image and a matching mask. The mask is why this is more than a toy - a clean rectangular mask is exactly what you need to seed an inpaint region, block out a composite area, or build a simple frame, and generating one by hand is more annoying than it sounds.

    What you'd do with it

    Masking, mostly. Say you want to inpaint a specific rectangular chunk of an image, or composite something into a defined box. You need a mask of that region. This node makes one at whatever position and size you specify, with anti-aliased edges so the boundary isn't jagged. You can also use the image output directly as a solid color block - a background plate, a color swatch, a placeholder.

    The inputs worth knowing

    There are a lot of them, but they group cleanly:

    • width / height - the canvas size.
    • left / top / right / bottom - these define the rectangle by its inset from each edge of the canvas, not as x/y/width/height. So left: 50 means the rectangle starts 50px in from the left. It's a slightly different mental model than you might expect, so glance at the preview the first time.
    • radius - corner rounding. Set 0 for hard corners, higher for a pill shape.
    • fill_red / fill_green / fill_blue - the color, 0–255 each.
    • fill_alpha - opacity, 0 to 1.
    • SSAA - supersampling, 1–16. The node draws at a larger size then shrinks down, which is what gives you smooth edges instead of aliased ones. 4 is a fine default; crank it for very smooth curves at the cost of a little speed.
    • method - the resampling filter used for that downsample (lanczos, bicubic, etc.). Lanczos is the clean pick.

    Outputs are the IMAGE (the drawn rectangle) and the MASK (the same shape as a mask). The mask is the one you'll wire into an inpaint or composite node.

    Practical notes

    The inset-from-each-edge layout is the only real head-scratcher - if your rectangle isn't where you expect, that's almost always why. SSAA at 4 with lanczos gives you nicely smooth rounded corners; there's rarely a reason to go past 8. And since it starts from a blank canvas, this makes shapes and masks, not edits to an existing image - for that you'd composite the output onto your picture in a later node.

    Installing ComfyUI-Addoor

    ComfyUI Manager: Install Custom Nodes → search "ComfyUI-Addoor" → install → restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Eagle-CN/ComfyUI-Addoor.git
    cd ComfyUI-Addoor
    pip install -r requirements.txt
    

    Restart and find it under 🌻 Addoor / Utilities. Preview the output once to get the feel for the inset-based positioning before you build around it.

    Category🌻 Addoor/Utilities

    Inputs (13)

    NameTypeDefaultDescription
    widthINT512
    heightINT512
    leftINT50
    topINT50
    rightINT50
    bottomINT50
    radiusINT20
    fill_redINT2550–255
    fill_greenINT2550–255
    fill_blueINT2550–255
    fill_alphaFLOAT1.000–1
    SSAAINT41–16
    methodCOMBO6 options: lanczos, bicubic, hamming, bilinear, box, nearest

    Outputs (2)

    NameTypeDescription
    IMAGEIMAGE
    MASKMASK