Nodes/Allor Plugin/ImageDrawLine
ComfyUI Node

ImageDrawLine

Draw a straight line with a thickness, anti-aliased

By Nourepide·Created 3 years ago·Updated 2 years ago· 296
ImageDrawLine
    • IMAGE
    width256
    height256
    size1
    start_x0.00
    start_y0.00
    end_x1.00
    end_y1.00
    red255
    green255
    blue255
    alpha1.00
    SSAA4
    method

    ImageDrawLine draws a straight line from one normalized point to another on a transparent RGBA canvas, with a thickness you control and anti-aliasing that actually looks decent. It sounds trivial, but a clean, thick, compositable line is genuinely annoying to produce in stock ComfyUI - this gives you one in a single node.

    How it works

    Same pipeline as every Allor draw node: RGBA canvas, PIL ImageDraw.line, supersample by SSAA, downscale with method, output a single IMAGE tensor. The coordinates are normalized fractions of the canvas - 0 is one edge, 1 is the opposite edge - which means the same values work at any canvas size.

    Inputs that matter:

    • width / height - canvas size, default 256×256.
    • start_x / start_y, end_x / end_y - the line's endpoints as 0–1 fractions. Defaults run from top-left (0,0) to bottom-right (1,1) - a diagonal. For a horizontal line across the middle, use 0, 0.5 → 1, 0.5.
    • size - line thickness in pixels, default 1.
    • red / green / blue / alpha - color, alpha defaulting to 1 (opaque).
    • SSAA (default 4) and method (default lanczos).

    Where people get burned

    Two things. First, the line can sit partially off-canvas - an endpoint of exactly 1 means the line's edge is flush against the border, and with a thick size the outer half of the stroke gets clipped. Pull endpoints slightly inside (e.g. 0.02–0.98) if you want a fully visible line. Second, the output is RGBA with a transparent background, so a lone line floats on a checkerboard in Preview - expected behavior for compositing, surprising if you wanted a solid backdrop.

    Why you'd use it

    Separator rules, grid lines, arrow shafts (composite the head on top), underline effects, or any vector-ish element you're layering over a generated image. Because the output has real alpha, it blends rather than hard-stamping.

    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 (13)

    NameTypeDefaultDescription
    widthINT256
    heightINT256
    sizeINT1
    start_xFLOAT0.00
    start_yFLOAT0.00
    end_xFLOAT1.00
    end_yFLOAT1.00
    redINT255
    greenINT255
    blueINT255
    alphaFLOAT1.00
    SSAAINT41–16
    methodCOMBO6 options: lanczos, bicubic, hamming, bilinear, box, nearest

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE