OpenCV line_1
OpenCV line_1 — yes, it's the same as line_0, here's how to use the line drawer anyway
- img
- nparray
Straight to it: OpenCV line_1 and OpenCV line_0 are identical. Every _0/_1 pair in this pack is the same function twice, because OpenCV declares its functions with two overloads (plain matrices and OpenCL-backed UMat) and the pack's generator numbered them instead of deduplicating. So the real question isn't "which one do I need" - it's "do I need this at all."
The answer is: when you want to draw a line on an image inside a workflow, without loading a model, this is how. It's cv2.line wrapped as a node - the primitive underneath every box overlay, ruler callout, and "look at this region" arrow in image-processing land. If you've ever wanted to mark two points on a generated frame and save the result, this is a one-node solution.
What you actually type
Because the pack parses composite types as Python-literal strings, the drawing coordinates and the color are text boxes, not nice number widgets:
- pt1 =
[50, 50]- start point - pt2 =
[400, 300]- end point - color =
[0, 255, 0]- BGR, not RGB (green here; flip it to[255, 0, 0]and you get blue - one of OpenCV's most reliable footguns)
Parens work too: (50, 50). Malformed syntax gives you the pack's signature invalid syntax (<unknown>, line 0).
The remaining inputs:
- img -
NPARRAYin (rememberImage2Nparray/Nparrays2Imageto cross between Comfy and OpenCV world). - thickness - pixels wide;
1–2for hairlines, higher for markers. - lineType -
16is anti-aliased (LINE_AA, use it),8is not.4is 4-connected. - shift - sub-pixel bit-shift precision.
0.
One output, nparray, the image with the line drawn.
Install
Same as every node in the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python
Restart ComfyUI. Or use ComfyUI Manager (search "opencv"). Dependencies are just opencv-contrib-python, numpy, torch - no models to fetch.
The gotchas
- Wrong color / invisible line - check BGR ordering, and make sure
pt1/pt2are within the image bounds. Drawing outside the frame isn't an error, it's just nothing. invalid syntax- a typo in a literal string. The error message is unhelpful; check the string boxes first.- Batch error -
Only images with batch_size==1 are supported!→ImageFromBatchwithlength=1before converting.
One more honest note: the author himself said in his r/comfyui announcement that this pack isn't simpler than the big image-processing suites - "No ;)" was his literal answer when asked. It's for people who want raw, intentional cv2 access. If drawing lines is all you need, a dedicated annotation pack will give you friendlier inputs; if you're already elbow-deep in nparrays, line_1 is right there.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| img | NPARRAY | — | |
| pt1 | STRING | — | |
| pt2 | STRING | — | |
| color | STRING | — | |
| thickness | INT | — | |
| lineType | INT | — | |
| shift | INT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |