Write Text On Image
This function block adds customizable text overlays onto images. It scales text relative to image size, lets you position the text using normalized coordinates, and optionally draws a semi-transparent background behind the text for better readability.
π₯ Inputs
Image Any Accepts the image to draw text on.
String Optional text input. If left empty the block will draw an empty string (no visible text).
π€ Outputs
Image Any The image with the applied text overlay.
πΉοΈ Controls
Text Position Horizontal Move text left/right using a normalized value (0.0 = left, 1.0 = right).
Text Position Vertical Move text up/down using a normalized value (0.0 = top, 1.0 = bottom).
Font Scale Adjust overall text size relative to the image.
Font Thickness Adjust the stroke thickness of the text.
Font Choose the font style from available options.
Color Select the text color.
Background Enabled Toggle a semi-transparent background rectangle behind the text for improved contrast.
π¨ Features
Automatic scaling so text size adapts to image dimensions for consistent appearance across different resolutions.
Normalized positioning makes it easy to place text proportionally, independent of image size.
Semi-transparent background option improves legibility on busy images.
Works with dynamic text inputs so overlays can display variable content (e.g., IDs, labels, sensor readings).
π How it runs
When the block runs it reads the incoming image and the current control values, computes an appropriate font scale and position based on the image dimensions, draws the optional background rectangle (if enabled), renders the text with the selected font, color and thickness, and outputs the resulting image for downstream blocks.
π Usage instructions
Connect a source that provides the image to
Image Any.Provide text to the
Stringinput or leave it empty to use the blockβs internal text.Adjust
Font,Color,Font ScaleandFont Thicknessfor desired appearance.Use
Text Position HorizontalandText Position Verticalto place the text.Enable
Background Enabledif you need higher contrast on complex images.Preview the output by connecting this block to a display block such as
Show Imageor save the result withImage Write/Image Logger.
π‘ Tips and Tricks
To stamp a running timestamp, feed the
Stringinput from theDate-TimeorDate-Time Listblock and combine formatting in aString Mergeblock before feeding it in.For live preview while tuning position and scale, connect the output to the
Show Imageblock.If you need to write labels only within a specific area, crop first with
Image ROIorImage ROI Selectand then apply this block.Use
Image Resizebefore writing text if you want consistent final text size across images that vary widely in resolution.To save annotated frames, connect the output to
Image LoggerorImage Write.To overlay detection results, combine with detection blocks like
Find ObjectorObject Detectionand feed detected labels or counts into theStringinput.When drawing conditional status text (e.g., OK / NOK), use logical blocks (for example
Logic Inputor comparison blocks) and aString Mergeto assemble the display text before sending it to this block.
π οΈ Troubleshooting
Text appears too small or too large: adjust
Font Scaleor resize the input image withImage Resizefor consistent results.Text is unreadable on busy backgrounds: enable
Background Enabledor changeColorto a high-contrast value.Text position seems off on different images: use normalized
Text Position HorizontalandText Position Verticaland verify placement on a representative image usingShow Image.
Last updated