Teeth Image Grid Lines
Draw Grid Lines on an Image (the Visual Partner to Split Grid)
- image
- GridLinesImage
You've got a contact sheet, a layout preview, or an image you're about to slice into tiles, and you want to see where the cuts land before you make them. Teeth Image Grid Lines draws a grid overlay straight onto an image - color, thickness, and grid density you choose. It's the visual partner to the same pack's Teeth Split Grid Image: one draws the lines, the other cuts along them.
ComfyUI-Teeth is a small single-author utility pack, and this node is its simplest possible member: an image in, an image out with lines on it. No models, no setup, no hidden cost.
How it works
Under the hood it's PIL ImageDraw drawing straight lines. The image tensor becomes a PIL image, and the node draws h_grids horizontal lines plus v_grids vertical lines across it, spacing them evenly with a margin - line i sits at (height / (h_grids + 1)) * i.
That division is the part to internalize: the numbers are interior lines, not cell counts. h_grids = 1 draws one horizontal line, splitting the image in half (a 2×2 layout). h_grids = 2 draws two lines, giving three bands. So to mark a 4-grid (2×2) you want h_grids = 1, v_grids = 1; to mark a 9-grid (3×3) you want h_grids = 2, v_grids = 2. Match those to what you'll feed Split Grid Image and the lines land exactly on the future cuts.
Inputs and outputs that matter
- image (IMAGE, required) - what gets the lines.
- border_color - a hex string like
#FF0000for red. Default#000000black. - border_width - line thickness in pixels. Default 10, which is chunky; knock it to 2–4 for a reference grid.
- h_grids / v_grids - horizontal and vertical line counts (the interior-divider numbers above).
- GridLinesImage (output) - the image with lines drawn.
Where people get burned
Invalid hex is a silent no-op. Type a color that isn't exactly six hex digits after the # and the node prints an error to the console and returns the original image unchanged. No UI error, no warning on the node - you'll just wonder why nothing appeared. #RRGGBB only; no named colors, no alpha.
Default thickness is a brick wall. At 10px wide on a small image, the grid isn't a reference, it's the picture. Dial it down.
The off-by-one grid math. Most people set h_grids = 3 expecting three cells per side and get three lines (four cells). If your cuts don't line up with where you expected, recount using the "+1 cells" rule.
Install
ComfyUI Manager: search ComfyUI-Teeth. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/steelan9199/ComfyUI-Teeth
Restart ComfyUI. Dependencies are just numpy, Pillow, and torch - the pack's requirements.txt includes opencv-python and google-genai for its other nodes, but this one touches none of them. No models, no downloads, no config.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| border_color | STRING | #000000 | — |
| border_width | INT | 101–999999999 | — |
| h_grids | INT | 31–999999999 | — |
| v_grids | INT | 31–999999999 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| GridLinesImage | IMAGE | — |