Skip to content

getTextSize1

Image processingfunctionOpenCV 5.0.0
import { getTextSize1 } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSimgsize, text, org, fface
FUNCTIONgetTextSize1
RETURN TYPERect
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Calculates the bounding rect for the text

The function cv::getTextSize calculates and returns the size of a box that contains the specified text. That is, the following code renders some text, the tight box surrounding it, and the baseline: :

getTextSize1(imgsize: Size, text: EmbindString, org: Point, fface: FontFace, size: number, weight: number, flags: number, wrap: Range): Rect;
4 available overloads
getTextSize1(imgsize: Size, text: EmbindString, org: Point, fface: FontFace, size: number): Rect;
getTextSize1(imgsize: Size, text: EmbindString, org: Point, fface: FontFace, size: number, weight: number): Rect;
getTextSize1(imgsize: Size, text: EmbindString, org: Point, fface: FontFace, size: number, weight: number, flags: number): Rect;
getTextSize1(imgsize: Size, text: EmbindString, org: Point, fface: FontFace, size: number, weight: number, flags: number, wrap: Range): Rect;
imgsize

Size of the target image, can be empty

text

Text string to be drawn.

org

Bottom-left corner of the first character of the printed text (see PUT_TEXT_ALIGN_... though)

fface

The font to use for the text

size

Font size in pixels (by default) or pts

weight

Font weight, 100..1000, where 100 is "thin" font, 400 is "regular", 600 is "semibold", 800 is "bold" and beyond that is "black". The default weight means "400" for variable-weight fonts or whatever "default" weight the used font provides.

flags

Various flags, see PUT_TEXT_...

wrap

The optional text wrapping range; see #putText.

Returns

The Rect result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.