Nodes/Allor Plugin/ImageDrawPolygon
ComfyUI Node

ImageDrawPolygon

Draw a regular polygon — pentagons, hexagons, stars

By Nourepide·Created 3 years ago·Updated 2 years ago· 295
ImageDrawPolygon
    • IMAGE
    size256
    sides5
    rotation0
    outline_size1
    outline_red0
    outline_green0
    outline_blue0
    outline_alpha1.00
    fill_red255
    fill_green255
    fill_blue255
    fill_alpha1.00
    SSAA4
    method

    ImageDrawPolygon draws a regular polygon - equal sides, centered - on a transparent RGBA canvas. It's the one draw node that's a bit different from its siblings: instead of a bounding box, you pick a square canvas size, a side count, and a rotation, and it centers the shape for you. Pentagons, hexagons, octagons, or a triangle if you like - with an outline and a fill.

    How it works

    Same Allor draw pipeline (RGBA canvas, PIL drawing, supersample by SSAA, downscale with method), but here the shape comes from PIL's regular_polygon: a center point, a radius, sides, and rotation. The canvas is a square - there's a single size input, not width/height - and the polygon is always centered in it.

    Inputs that matter:

    • size - the square canvas's side length in pixels, default 256. Both dimensions are this value.
    • sides - number of sides, minimum 3, default 5. 3 = triangle, 5 = pentagon, 6 = hexagon, and so on up to an approximation of a circle.
    • rotation - rotation of the shape in degrees (0–360), default 0. At 0, a pentagon's first vertex points along the default orientation; rotate to put a flat side down if that's the look you want.
    • outline_size - outline stroke width, default 1.
    • outline_red / green / blue / alpha - outline color, default black.
    • fill_red / green / blue / alpha - fill color, default white.
    • SSAA (default 4) and method (default lanczos).

    The gotcha

    Output is RGBA with a transparent background, like the whole draw family - the polygon floats on a checkerboard in Preview. That's the compositing-friendly behavior, but if you wanted a solid backdrop you'll composite onto a container yourself. There's no ByContainer variant for this node (the others have one), so if you need it at an image's exact size you'd create a container of that size, or just set size to match.

    Why you'd use it

    Badges, stop-sign overlays, shield shapes, honeycomb backgrounds, or any geometric graphic. Because the shape is regular and centered by construction, you don't have to fiddle with vertices - the side count and rotation are all you need.

    Installing Allor

    Part of the Allor Plugin (Nourepide/ComfyUI-Allor), ~90 nodes from early 2024:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Nourepide/ComfyUI-Allor
    cd ComfyUI-Allor
    pip install -r requirements.txt
    

    Restart, or search "Allor Plugin" in ComfyUI Manager - the more reliable route given the pack's history of manual-install import errors. Dependencies are rembg + onnx; drawing needs no models.

    Gotchas that apply to the whole pack

    The repo was rebased to strip images from history (shrank ~344×), so auto-update can occasionally break - the README's update-troubleshooting docs cover it; delete-and-reclone is the blunt fix. [Allor] console lines at startup are the pack writing config.json and checking updates, not an error.

    Categoryimage/draw

    Inputs (14)

    NameTypeDefaultDescription
    sizeINT256
    sidesINT5
    rotationINT0
    outline_sizeINT1
    outline_redINT0
    outline_greenINT0
    outline_blueINT0
    outline_alphaFLOAT1.00
    fill_redINT255
    fill_greenINT255
    fill_blueINT255
    fill_alphaFLOAT1.00
    SSAAINT41–16
    methodCOMBO6 options: lanczos, bicubic, hamming, bilinear, box, nearest

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE