Nodes/ComfyUI-Purz/Grid Pattern (Purz)
ComfyUI Node

Grid Pattern (Purz)

The graph-paper node with three line styles

By purzbeats·Created about a year ago·Updated 3 months ago· 24
Grid Pattern (Purz)
    • image
    width512
    height512
    grid_size32
    line_width2
    background_color#FFFFFF
    line_color#000000
    stylesolid
    batch_size1

    Sometimes you just need graph paper as an image. PurzGridPattern generates a clean grid overlay at any size, with a choice of solid, dashed, or dotted lines and full control over spacing and colors. It's the sort of node that feels trivial until you're compositing a blueprint effect, checking lens distortion, or building UI mockup backgrounds - and then it's exactly what you wanted.

    It's one of the Purz/Patterns/Basic generators in ComfyUI-Purz, the utility pack by PurzBeats (a Comfy Org staffer). Like its siblings, it generates from nothing - no image input, just parameters and an IMAGE out.

    How it works

    Pure Pillow drawing, so it's fast and resolution-independent. It fills a canvas with background_color, then draws vertical and horizontal lines at every grid_size interval using line_color. The style dropdown changes how each line is rendered: solid draws continuous lines, dashed breaks each line into short segments (10px on, 10px off), and dotted replaces lines with a row of round dots. That's the whole engine - no sampling, no interpolation, nothing that can surprise you.

    The inputs that matter

    • width / height - canvas size, 64–4096.
    • grid_size - spacing between grid lines, 8–256. Small values give dense graph paper; large values give a sparse blueprint grid.
    • line_width - 1–20, thickness of the lines (or diameter of the dots). 1–2 is subtle; 5+ reads as bold design.
    • background_color / line_color - hex colors. Classic is white background, black lines; a dark background with light lines gives a "schematic" feel.
    • style - solid, dashed, or dotted.
    • batch_size - 1–16, identical frames if your workflow needs a batch.

    Output is image, an IMAGE at exactly your requested size.

    Installing it

    ComfyUI Manager - search ComfyUI-Purz - or:

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

    Restart ComfyUI. Requirements are OpenCV, Pillow, torch, numpy - nothing extra, no model downloads.

    Where people get burned

    Two small things. First, dashed and dotted use fixed internal segment/dot spacing, not a parameter - you can't control dash length, and the pattern isn't guaranteed to tile cleanly at every canvas size. If you need exact dashes or a perfectly seamless grid, you'll be doing it in a shader instead. Second, for a seamless repeating tile, keep width and height as clean multiples of grid_size (512×512 with 32-px cells works; 500×500 doesn't) or you'll get a clipped line at the edge. Beyond that, it's a "set it and forget it" node - which is exactly what a grid should be.

    CategoryPurz/Patterns/Basic

    Inputs (8)

    NameTypeDefaultDescription
    widthINT51264–4096
    heightINT51264–4096
    grid_sizeINT328–256
    line_widthINT21–20
    background_colorSTRING#FFFFFF
    line_colorSTRING#000000
    styleCOMBOsolid3 options: solid, dashed, dotted
    batch_sizeINT11–16

    Outputs (1)

    NameTypeDescription
    imageIMAGE