Nodes/opencv-comfyui/OpenCV addText_0
ComfyUI Node

OpenCV addText_0

A text node that draws in place and returns nothing — skip it

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV addText_0
  • img
  • unknown
text
org
nameFont
pointSize
color
weight
style
spacing

I'm going to give you the whole article up front: don't use addText_0. It's the pack's own poster child for "expect dragons", and the author is aware - his README's todo list includes blacklisting functions that "don't make sense in ComfyUI (like return type None)", and this is precisely that function. Here's the trap, grounded in the actual generated code.

The problem is the output

addText_0 wraps cv2.addText(img, text, org, nameFont, pointSize, color, weight, style, spacing) - the FreeType text-drawing function from the opencv-contrib modules (the reason this pack installs opencv-contrib-python). In plain Python, cv2.addText draws text in place on the img array and returns None. The auto-generator faithfully reproduced that: this node's output type is None and the output name is unknown. Which means after this node there is nothing to connect to anything else. You can't wire it into Nparrays2Image, you can't feed it onward - the annotated image never comes out the other side.

In-place mutation of an input is also just not how ComfyUI is meant to work. Nodes are supposed to take values in and hand new values out; relying on a node to side-effect an input array is fighting the framework. Even in cases where it happens to "work" through shared memory, you have no guarantee the text actually lands in the image you think you're editing. It's not a stable pattern - it's an artifact of auto-generating nodes from cv2's type definitions without knowing which functions fit ComfyUI's model.

The inputs it asks for

If you're curious what it would take to drive it (and why it's fiddly), the schema is: img (NPARRAY), text (STRING), then a pile of styling parameters - org (STRING), nameFont (STRING), pointSize (INT), color (STRING), weight (INT), style (INT), spacing (INT).

Two of those are themselves traps: org and color are STRING inputs that the generator parses with literal_eval, so you'd type them as Python tuples - "(30, 40)" for the text position and "(255, 0, 0)" for the color in BGR order. And nameFont is a font name for FreeType - not a file path you pick from a dropdown, but a name of a font the module is expected to have loaded, which the standalone cv2.addText call doesn't set up on its own. Getting all that right would still leave you with no output to use.

What to do instead

If you need text burned into an image in ComfyUI, use a dedicated text-overlay node from a general utility pack - several exist that render text as an image and composite it properly, outputting a real IMAGE you can keep working with. addText_0 is the wrong tool, and now you know it before wasting an evening on it.

Installing (if you still want the pack)

ComfyUI Manager → search "opencv-comfyui", or:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui

Restart. The contrib OpenCV is what makes addText exist at all:

pip install opencv-contrib-python

The one-sentence verdict

Every pack has a node that teaches you something about the pack's design philosophy; addText_0 is that lesson for opencv-comfyui - auto-generated coverage means some functions are listed that ComfyUI structurally can't use. Treat this one as documentation of the boundary, and pick a real text node.

Categoryimage/OpenCV

Inputs (9)

NameTypeDefaultDescription
imgNPARRAY
textSTRING
orgSTRING
nameFontSTRING
pointSizeINT
colorSTRING
weightINT
styleINT
spacingINT

Outputs (1)

NameTypeDescription
unknownNone