OpenCV arrowedLine_0
Draw annotated arrows on your outputs with OpenCV
- img
- nparray
If you're building a workflow that explains itself - pointing at the face a detector found, showing a motion direction, marking a crop origin - you need arrows, and ComfyUI core doesn't give you a friendly one. arrowedLine_0 is OpenCV's cv2.arrowedLine wrapped as a node: draw a line with an arrowhead on an image. It's a drawing primitive, nothing fancy, and it's the kind of node you keep on hand for annotating outputs before you save them.
It comes from opencv-comfyui, the auto-generated pack of OpenCV wrappers. The author's own framing is "these nodes are ugly and complex to use, expect dragons" - and this one earns a little of that, because the coordinates and colors arrive as string literals you have to type just right.
The inputs, and the one that bites
- img - the image to draw on, as an
NPARRAY. Note OpenCV draws in place: the outputnparrayis the image with the arrow painted on. - pt1 / pt2 - the arrow's start and end, typed as Python-literal strings:
"(30, 40)". Coordinates are(x, y). - color - also a string literal, but in BGR, because this is OpenCV:
"(0, 0, 255)"is red. If your arrow comes out blue when you asked for red, this is why. - thickness - line thickness in pixels (int).
- line_type - line drawing mode.
4and8are the classic 4/8-connected line algorithms;16is anti-aliased (LINE_AA), which is the one you want for nice-looking output. - shift - fractional-pixel precision shift, almost always
0for beginners. - tipLength - the arrowhead size as a fraction of the line length (0–1).
0.1is a sensible starting point; OpenCV's default is0.1too. - Output: one nparray, the annotated image.
The gotcha is the literals. These widgets are parsed with Python's ast.literal_eval, so the exact syntax matters: "(30, 40)" works, "30, 40" also happens to work, but "(30, 40" or "30 40" throws the pack's signature invalid syntax (<unknown>, line 0) error. If you see that, check your parens before anything else.
Wiring it up
In: Image2Nparray (remember, the pack speaks OpenCV arrays, not Comfy IMAGE). Out: Nparrays2Image to preview or save. Everything is BGR inside the pack, so cvtColor (code 4 = BGR2RGB) is a legit middle step if you're composing with other ComfyUI nodes that expect RGB.
Install
ComfyUI Manager → search opencv-comfyui, or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-python-contrib
Restart ComfyUI. No model downloads. The pack's only setup trap is conflicting OpenCV installs (Cannot import name 'guidedFilter' from 'cv2.ximgproc') - reinstall cleanly if it bites.
One more thing: arrowedLine_1 is this node's identical twin (the generator made two wrappers from OpenCV's MatLike/UMat overloads). Either works; don't overthink the badge number.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| img | NPARRAY | — | |
| pt1 | STRING | — | |
| pt2 | STRING | — | |
| color | STRING | — | |
| thickness | INT | — | |
| line_type | INT | — | |
| shift | INT | — | |
| tipLength | FLOAT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |