Line
Draw a line on an image, with an honest coordinate system
- image
- ui_widget
- image
- image_list
Every now and then a workflow needs to put a line on an image - a guideline for an editor, an annotation for a review pass, a composition ruler. LF_Line does exactly one thing and does it well: draw a line between two points in normalized coordinates, with control over thickness, color, opacity, and smoothness.
The normalized coordinate system is the detail that makes this node pleasant. Instead of pixels, you get positions as values between 0 and 1 - start_x 0 is the left edge, 1 is the right edge, same for start_y top to bottom. That means the same workflow draws a centered vertical line whether your image is 512×512 or 2K, with no resolution math in your head. The defaults already draw a vertical line down the middle (start_x 0.5, start_y 0 → end_x 0.5, end_y 1), which is a decent starting point to tweak.
How it works
The required inputs are the geometry and the styling. start_x, start_y, end_x, end_y define the line in that 0–1 space. size (1–500, default 10) is the line diameter in pixels - yes, diameter, the tooltip says so, so it reads as thickness. color is a hex string (default FF0000, red). opacity (0–1) fades the line in. smooth (boolean) switches from a hard-edged line to an antialiased one, which you want when the line is part of a final image rather than a rough guide.
There's also an optional mid_x / mid_y pair - a control point that bends the line into a curve when smooth is on. With straight lines it's irrelevant; with smooth on, it turns the node into a simple curve drawer.
Outputs are image and image_list, same as the other filters in this pack, so it composes with the rest of your chain.
Installing it
Part of LF Nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/lucafoscili/comfyui-lf
Restart, or use ComfyUI Manager and search LF Nodes. No models, no downloads beyond the pack's light dependencies (numpy, Pillow, opencv-python).
Gotchas
The coordinate system trips people up once. Because everything is normalized 0–1, a start_x of 0.5 really is the horizontal middle regardless of aspect ratio - but remember Y runs top to bottom, so start_y 0 is the top edge. Getting a line "upside down" is almost always this.
And when the line looks jagged, it's the smooth toggle, not a bug. Hard edges are the default; flip smooth on for anything that's going into a final render.
Pack note: comfyui-lf is legacy, frozen Feb 2025, and the author's active development moved to lucafoscili/lf-nodes. The frozen build here works fine and the compare preview is already the best part.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Input image tensor to draw a line upon. | |
| start_x | FLOAT | 0.500–1 | Horizontal position to begin the line drawing, expressed as a value between 0 and 1. |
| start_y | FLOAT | 0.000–1 | Vertical position to begin the line drawing, expressed as a value between 0 and 1. |
| end_x | FLOAT | 0.500–1 | Horizontal position to end the line drawing, expressed as a value between 0 and 1. |
| end_y | FLOAT | 1.000–1 | Vertical position to end the line drawing, expressed as a value between 0 and 1. |
| size | INT | 101–500 | Diameter of the line in pixels. |
| color | STRING | FF0000 | Hex color of the line. |
| opacity | FLOAT | 1.000–1 | Opacity of the line. |
| smooth | BOOLEAN | false | Draws a smooth line. |
| mid_xopt | FLOAT | 0.250–1 | Horizontal midpoint of the line, expressed as a value between 0 and 1. |
| mid_yopt | FLOAT | 0.250–1 | Vertical midpoint of the line, expressed as a value between 0 and 1. |
| ui_widgetopt | KUL_COMPARE | [object Object] | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| image_list | IMAGE | — |