Nodes/Allor Plugin/ImageDrawRectangleRounded
ComfyUI Node

ImageDrawRectangleRounded

Rounded rectangles without the jagged corners

By Nourepide·Created 3 years ago·Updated 2 years ago· 295
ImageDrawRectangleRounded
    • IMAGE
    width256
    height256
    start_x0.10
    start_y0.20
    end_x0.90
    end_y0.80
    radius180
    outline_size1
    outline_red0
    outline_green0
    outline_blue0
    outline_alpha1.00
    fill_red255
    fill_green255
    fill_blue255
    fill_alpha1.00
    top_left_corner
    top_right_corner
    bottom_right_corner
    bottom_left_corner
    SSAA4
    method

    Rounded-corner boxes are one of those things every post-processing workflow eventually needs - a card behind a caption, a pill-shaped button, a frame that doesn't look like it was cut with scissors. ImageDrawRectangleRounded from the Allor plugin does exactly that, on a canvas you size yourself with width and height, and it gives you the one thing most similar nodes skip: the ability to round only some corners.

    How it works

    The node draws with PIL's rounded_rectangle onto a transparent RGBA canvas. You set the canvas with width and height, then define the box with the same normalized 0–1 coordinates as the other Allor draw nodes - start_x, start_y, end_x, end_y are fractions of the canvas, so the same layout works at any resolution. The radius input (0–360) controls corner curvature, and here's the nice bit: top_left_corner, top_right_corner, bottom_right_corner, and bottom_left_corner are each true/false toggles. Turn off the bottom corners and you have a speech-bubble-ish header card; turn them all on and you get the classic rounded rect.

    Like the other Allor draw nodes it's supersampled: SSAA (default 4) renders at 4× then downsamples with your chosen method (lanczosnearest). That's what keeps rounded edges smooth instead of stairstepped. Colors work the same way too - fill_red/green/blue plus fill_alpha for the body, outline_red/green/blue, outline_alpha and outline_size for the stroke.

    Inputs that matter

    • width / height - canvas size in pixels (unlike the "ByContainer" variants, there's no reference image here).
    • start_x / start_y / end_x / end_y - the box, as 0–1 fractions of the canvas.
    • radius - corner roundness, 0 to 360. It's a radius in the scaled drawing space, so don't overthink the absolute number - nudge it until it looks right.
    • The four *_corner toggles - the reason to pick this node over a plain rounded-rect.
    • SSAA and method - anti-aliasing quality vs. speed.

    Output is a single IMAGE, RGBA with transparency outside the rectangle, so composite it over your render rather than treating it as a finished frame.

    Installing it

    This is part of the Allor plugin (~90 nodes in one pack), installed once:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Nourepide/ComfyUI-Allor
    

    Restart ComfyUI afterward, or use ComfyUI Manager and search for Allor Plugin. The pack's requirements.txt pulls in rembg and onnx, so the first launch after install takes a while - the drawing nodes themselves don't need models.

    Gotchas

    • Watch the update gotcha that hits everyone on Allor: the repo history was rebased to drop old images, so an old clone can fail on git pull. If auto-update throws, the fix is a clean re-clone (docs on the pack README cover it).
    • The output is transparent outside the rectangle - don't save it standalone and wonder where your background went.
    • radius is a drawing-space value scaled by SSAA. If your corners look over-round at high SSAA, that's normal; just lower the radius.

    If you'd rather have the box match an existing image's dimensions automatically, the sibling node ImageDrawRectangleRoundedByContainer takes a container IMAGE instead of width/height.

    Categoryimage/draw

    Inputs (22)

    NameTypeDefaultDescription
    widthINT256
    heightINT256
    start_xFLOAT0.10
    start_yFLOAT0.20
    end_xFLOAT0.90
    end_yFLOAT0.80
    radiusINT180
    outline_sizeINT1
    outline_redINT0
    outline_greenINT0
    outline_blueINT0
    outline_alphaFLOAT1.00
    fill_redINT255
    fill_greenINT255
    fill_blueINT255
    fill_alphaFLOAT1.00
    top_left_cornerCOMBO2 options: true, false
    top_right_cornerCOMBO2 options: true, false
    bottom_right_cornerCOMBO2 options: true, false
    bottom_left_cornerCOMBO2 options: true, false
    SSAAINT41–16
    methodCOMBO6 options: lanczos, bicubic, hamming, bilinear, box, nearest

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE