Nodes/opencv-comfyui/OpenCV putText_1
ComfyUI Node

OpenCV putText_1

PutText_1 — fonts, anti-aliasing, and the color trap that gets everyone

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV putText_1
  • img
  • nparray
text
org
fontFace
fontScale
color
thickness
lineType
bottomLeftOrigin

putText_1 is putText_0 with a different serial number. The opencv-comfyui pack generates a node for each of cv2.putText's overloaded signatures, both landed in the graph, and they behave identically - img, text, org, fontFace, fontScale, color, thickness, lineType, bottomLeftOrigin in, one nparray out with text baked into the pixels. So this article skips the "what it is" (that's the putText_0 page) and goes straight to the parts that actually trip people up: the fonts, the enums, and the color format.

The font enum (fontFace)

These are integer enums, because this pack doesn't do friendly dropdowns. The practical set:

  • 0 - FONT_HERSHEY_SIMPLEX. The workhorse. Normal weight, readable.
  • 1 - FONT_HERSHEY_PLAIN. Thin, small, minimalist.
  • 2 - FONT_HERSHEY_DUPLEX. SIMPLEX but slightly bolder.
  • 5 - FONT_HERSHEY_COMPLEX_SMALL. Compact, good for dense labels.
  • 16 - FONT_ITALIC. Slants whichever face it's OR'd with (0 | 16 = italic SIMPLEX).

lineType of 16 (LINE_AA) is the one you want for anything that'll be looked at - it anti-aliases the glyph edges. The default 8 (LINE_8) leaves jagged pixels.

The color trap (color)

The color field is a STRING parsed as a Python literal, and it is BGR, 0..255 - OpenCV's world, not ComfyUI's 0..1 RGB world. So:

  • Red: (0, 0, 255)
  • Green: (0, 255, 0)
  • Blue: (255, 0, 0)
  • White: (255, 255, 255)

The two classic mistakes: typing RGB order (you get a "wrong" color that's suspiciously close - magenta vs. green type mixups) and typing normalized 0..1 values (you get a near-black "invisible" text and blame the node). If you're pulling a color from a ComfyUI picker that's 0..1 RGB, convert before it reaches this field.

Sizing text to your image (fontScale)

fontScale is relative, not absolute - the same value produces tiny text on a 4K image and enormous text on a 512px one. There's no auto-fit, so if you're watermarking at multiple resolutions, scale it with the image (roughly height/500 as a starting point for SIMPLEX is a decent heuristic). And org, the bottom-left corner, is a literal too: (x, y) - with text extending up and right from it.

Install

Standard for the pack: ComfyUI Manager → search "opencv-comfyui", or

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

restart, then pip install opencv-contrib-python. Feed it through Image2Nparray (batch size 1 only; ImageFromBatch length 1 fixes the batch error), and remember Nparrays2Image on the way out.

Bottom line

Text overlays in ComfyUI are thin on the ground, and putText_1/putText_0 are the no-download, no-drama option - once you accept the BGR + literal-syntax reality. The pack's author warned the whole collection is auto-generated and "ugly and complex to use. Expect dragons!" putText_1 is genuinely one of the least dragon-y nodes in it. The only dragons live in the color field and the fontScale number, and you've now been told about both - that's the whole game.

Categoryimage/OpenCV

Inputs (9)

NameTypeDefaultDescription
imgNPARRAY
textSTRING
orgSTRING
fontFaceINT
fontScaleFLOAT
colorSTRING
thicknessINT
lineTypeINT
bottomLeftOriginBOOLEAN

Outputs (1)

NameTypeDescription
nparrayNPARRAY