Skip to main content

cv2.putText with new lines

Tested against Windows 10 / Python 3.11 / Anaconda

pip install cv2multilinewrite

Code from: https://stackoverflow.com/a/73471951/15096247

import cv2
import numpy as np

image = 200 * np.ones((550, 410, 3), dtype=np.uint8)

image = add_text_to_image(
    image,
    "New line\nDouble new line\n\nLine too longggggggggggggggggggggg",
    top_left_xy=(0, 10),
)
image = add_text_to_image(
    image,
    "Different font scale",
    font_scale=0.5,
    font_color_rgb=(0, 255, 0),
    top_left_xy=(0, 150),
)
image = add_text_to_image(
    image,
    "New line with bg\nDouble new line\n\nLine too longggggggggggggggggggggg",
    bg_color_rgb=(255, 255, 255),
    font_color_rgb=(255, 0, 0),
    top_left_xy=(0, 200),
)
image = add_text_to_image(
    image,
    "Different line specing,\noutline and font face",
    font_color_rgb=(0, 255, 255),
    outline_color_rgb=(0, 0, 0),
    top_left_xy=(0, 350),
    line_spacing=1.5,
    font_face=cv2.FONT_HERSHEY_SCRIPT_SIMPLEX,
)
import matplotlib.pyplot as plt

plt.imshow(image)
plt.show()

Metadata

Release files for cv2multilinewrite 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cv2multilinewrite 0.10
File Size Uploaded Provenance Actions
cv2multilinewrite-0.10.tar.gz 55.3 kB Without provenance Details for cv2multilinewrite-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cv2multilinewrite 0.10
File Interpreter ABI Platform Actions
cv2multilinewrite-0.10-py3-none-any.whl Python 3 none any Details for cv2multilinewrite-0.10-py3-none-any.whl

Total release size: 111.1 kB

Release files / cv2multilinewrite-0.10.tar.gz

Download URL cv2multilinewrite-0.10.tar.gz
Size 55.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a94863d08311b1c2e6c0f245921cf0870f85ae48e5f31cdd7b799c8728e740d3
BLAKE2b-256 checksum
How to use checksums
232277503bbe3c4264400ab13d6bc1f92e8a0e759aa60956d792a2efc18aa9e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / cv2multilinewrite-0.10-py3-none-any.whl

Download URL cv2multilinewrite-0.10-py3-none-any.whl
Size 55.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
882b88759d025d22f82b09268b5bdef0c8ee1246c76842ba73adc9c6b9b03e59
BLAKE2b-256 checksum
How to use checksums
1fd789f7c3da5cd68714039d179d2deab0ad33d7332e44b319d9add9a9259969
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for cv2multilinewrite 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page