Nodes/TJ_PolkaDot/Shape Mask Generator
ComfyUI Node

Shape Mask Generator

Clean stamps for your collage, no image editor required

By TJ16th·Created 11 months ago·Updated 11 months ago· 2
Shape Mask Generator
    • MASK
    shape_typecircle
    scale0.80
    position_x512
    position_y512
    rotation0
    feather0

    You need a heart-shaped mask, right now, and you do not want to open an image editor or hand-draw it pixel by pixel. That's the entire job of Shape Mask Generator (part of the TJ_PolkaDot pack): it stamps one clean shape onto a fixed 1024×1024 canvas and hands you a standard ComfyUI MASK in the time it takes to double-click. It's the starting stamp of every polka-dot collage workflow - the thing you feed into the pack's placement node so you're never sculpting masks by hand.

    It ships ten shapes: circle, heart, star, diamond, square, hexagon, triangle, cross, moon, and flower. Procedurally drawn, so there are no model files, no downloads, nothing to cache - it runs instantly on CPU. That's the whole pack's character, honestly: TJ16th's three-node collection, MIT-licensed, v0.1.0, and the README itself admits it was built with generative-AI help and has rough edges. The masks themselves are solid, though.

    How it works

    The node builds the shape directly onto a 1024×1024 float canvas, rotates it if you asked for rotation, then places it centered on whatever position_x / position_y you set. Nothing fancy under the hood - numpy and PIL, which is exactly why it's instant and why it works on any machine. Output is a single MASK in the usual 0–1 float range.

    The inputs that matter

    • shape_type - your pick of the ten shapes. This is a dropdown; there are no custom shape options.
    • scale - shape size relative to the canvas, 0.1 to 1.0 (default 0.8). At 1.0 the shape nearly fills the frame; at 0.1 it's a small stamp.
    • position_x / position_y - where the shape's center lands, 0–1024 (default 512/512, dead center).
    • rotation - degrees, −180 to 180. Set this per-stamp; the placement node has its own random rotation range later.
    • feather - edge blur in pixels, 0–50. 0 gives a hard-edged stamp; a few pixels softens the edge so shapes blend instead of cutting in.

    Where the MASK goes

    Its natural destination is AdvancedShapePlacement in the same pack - that's the node that scatters copies of this stamp. But a mask is a mask in ComfyUI, so it also works anywhere a mask does: feed it to a Color to Mask→Image pair to preview it as a shape, invert it, or composite it. Just remember the fixed 1024×1024 canvas - if your workflow runs at another resolution, resize the mask (or let the pack's compositor auto-fit it, which it does).

    One honest quirk: the README still talks about a size in pixels and a blur_radius, but the shipped node uses scale plus position_x/y and feather. The README is stale; trust the node.

    Install

    Standard custom-node install, and it's lightweight - dependencies are torch, numpy, and pillow, all of which ComfyUI already ships, so there's no pip dance and no model to download.

    ComfyUI Manager → Custom Nodes Manager → search "TJ_PolkaDot" → Install → restart
    
    # or by hand:
    cd ComfyUI/custom_nodes
    git clone https://github.com/TJ16th/ComfyUI-TJ-PolkaDot
    # then restart ComfyUI
    

    Troubleshooting

    • Node doesn't show up after install. The pack is written against ComfyUI's newer plugin API (the comfy_api extension system) rather than the classic NODE_CLASS_MAPPINGS convention, so it needs a recent ComfyUI. Update ComfyUI before blaming the pack.
    • Shape looks too soft. That's feather doing its job - set it to 0 for a crisp edge.
    • Shape is off-center. Check position_x/position_y, not the canvas. At scale 0.1 a tiny stamp in the middle is expected, not a bug.
    CategoryTJ_PolkaDot

    Inputs (6)

    NameTypeDefaultDescription
    shape_typeCOMBOcircle10 options: circle, heart, star, diamond, square, hexagon, +4
    scaleFLOAT0.800.1–1Size of the shape relative to canvas
    position_xINT5120–1024X position of shape center
    position_yINT5120–1024Y position of shape center
    rotationFLOAT0-180–180Rotation angle in degrees
    featherINT00–50Edge blur amount in pixels

    Outputs (1)

    NameTypeDescription
    MASKMASK