Nodes/ComfyUI_ZC_DrawShape/ZC DrawShape Node
ComfyUI Node

ZC DrawShape Node

The node that draws a circle, and right now that's about it

By zohacΒ·Created 2 years agoΒ·Updated 2 years agoΒ· 3
ZC DrawShape Node
    • IMAGE
    β—„width512β–Ί
    β—„height512β–Ί
    β—„shape_nameβ–Ύβ–Ί
    β—„shape_colorwhiteβ–Ί
    β—„back_colorblackβ–Ί
    β—„x_offset0β–Ί
    β—„y_offset0β–Ί
    β—„zoom1.00β–Ί
    β—„zoom_multiplier1.00β–Ί
    β—„batch1β–Ί

    ZC DrawShape is a tiny utility that paints a solid-color shape onto a solid-color canvas and hands you back a normal ComfyUI IMAGE tensor. Not an image file, not a mask - a batch of tensors you can wire straight into the rest of your graph. No API calls, no model downloads, no keys. It's a ~600-line single-commit pack, and it shows.

    Why would you reach for something this minimal? Because sometimes you need a known image to test the plumbing. VAE Encode β†’ KSampler β†’ decode, a ControlNet pass, an img2img round-trip - if the graph is mis-wired, a deterministic colored circle tells you instantly where, and it costs you nothing to generate. The author's own tagline is "nodes for artists, designers and animators"; realistically, it's a testing tool and a placeholder generator, not a compositing kit. If you need actual masks for inpainting, use ComfyUI's built-in Mask nodes instead - this thing only draws, it doesn't cut.

    How it works

    Under the hood it's a factory pattern: ZcDrawShapeFactory holds a registry mapping shape names to classes, and right now that registry has exactly one entry - circle. The circle class uses Pillow (ImageDraw.ellipse) to draw on a fresh RGB canvas, centered at width/2 + x_offset, height/2 + y_offset, with a radius of min(width - x_offset, height - y_offset) / 2 Γ— zoom Γ— zoom_multiplier. The result is normalized to 0–1 floats and stacked into a [batch, height, width, 3] tensor. Note the quirk baked into that formula: changing the offsets also changes the drawn size, not just the position, because the radius is computed from the offset-adjusted dimensions.

    At defaults (512Γ—512, zoom 1.0) the circle is inscribed - it touches all four edges. That's worth knowing before you go hunting for a bug: zoom below 1 shrinks it from there.

    The inputs that matter

    • shape_name - a dropdown with one option, circle. Pick your shape carefully.
    • shape_color / back_color - both use the same fixed seven-color palette: black, white, red, green, blue, yellow, magenta. No hex codes, no sliders, no "other."
    • zoom and zoom_multiplier - the pair that scales the shape. More on the first one below.
    • batch - how many identical copies to stack. Keep it at 1 or above; the widget's minimum says -2048 but anything ≀ 0 produces an empty stack and a RuntimeError.

    The single output is IMAGE, so it plugs into anything that expects an image - VAE Encode, ControlNet, image conditioning, an empty LatentImage's sibling for testing batch behavior.

    Installing it

    Easiest route is ComfyUI Manager - search for ZC DrawShape (pack title ComfyUI_ZC_DrawShape) and install, then restart ComfyUI. If you prefer the shell:

    cd ComfyUI/custom_nodes
    git clone https://github.com/zohac/ComfyUI_ZC_DrawShape
    

    Then restart. Two things to know: there's no requirements.txt and no model files - the only deps are torch, numpy, and Pillow, all of which ComfyUI already ships. And the README's own clone command is stale - it points at comfyui-shape-drawer.git, a repo that doesn't match this pack. Use the URL above or Manager.

    Where people get burned

    This is the part the README won't warn you about. In the version currently on GitHub, zoom is declared as a single FLOAT, but the drawing code indexes it like a list - and a float isn't subscriptable. Run the node with the default zoom and you get TypeError: 'float' object is not subscriptable. The README even advertises zoom as "an array of floats" for per-image zoom in a batch, which suggests the list-based design never fully made it into the UI. I confirmed this against the shipped code; if the author has pushed a fix by the time you read this, great - if you hit that TypeError, you now know exactly what's happening. The pack's own unit tests never cover the scalar-zoom path, so don't expect the repo to tell you otherwise.

    It's a brand-new project (v1.0, one commit, zero community discussion anywhere I could find), so treat it as a fun little test-bench node, not an infrastructure bet. When it works, it's instant and deterministic - which is honestly the best thing about it.

    CategoryπŸ‰ ZC Shape

    Inputs (10)

    NameTypeDefaultDescription
    widthINT51264–4096β€”
    heightINT51264–4096β€”
    shape_nameCOMBO1 options: circle
    shape_colorCOMBOwhite7 options: black, white, red, green, blue, yellow, +1
    back_colorCOMBOblack7 options: black, white, red, green, blue, yellow, +1
    x_offsetINT0-2048–2048β€”
    y_offsetINT0-2048–2048β€”
    zoomFLOAT1.000–10β€”
    zoom_multiplierFLOAT1.000–10β€”
    batchINT1-2048–2048β€”

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGEβ€”