Skip to main content

Text effects for OpenCV

$pip install a-cv2-text-effects



import os

from a_cv_imwrite_imread_plus import open_image_in_cv,save_cv_image

from a_cv2_text_effects import (

    put_ttf_font_multiline_in_box_at_exact_center_location_with_exact_size,

    put_ttf_font_multiline_at_exact_center_location_with_exact_size,

    put_ttf_font_multiline_at_exact_location_with_exact_size,

    put_ttf_font_multiline_in_box_at_exact_location_with_exact_size,

    put_ttf_font_in_circle_at_exact_location_with_exact_size,

    put_ttf_font_in_box_at_exact_location_with_exact_size,

    put_ttf_font_at_exact_location_with_exact_size,

    putTrueTypeText,

    center_text_at_certain_size_at_a_specific_point,

    center_of_text_at_certain_size_at_a_specific_point_with_boxes,

)



img = open_image_in_cv(

    "https://raw.githubusercontent.com/hansalemaos/screenshots/main/merg6.png"

)

maxwidth = 150

maxheight = 150



(

    imgresult1,

    ptLowerLeftTextOriginX2,

    ptLowerLeftTextOriginY2,

    intFontFace2,

    fltFontScale2,

    intFontThickness2,

    textSize2,

) = center_of_text_at_certain_size_at_a_specific_point_with_boxes(

    img,

    "Number 1",

    maxwidth,

    maxheight,

    wheretoput=(200, 200),

    color=(255, 255, 0),

    add_thickness_each=10,

    rectangle_border_size=5,

    rectangle_border_colors=((244, 255, 0), (244, 0, 255)),

)



(

    imgresult2,

    ptLowerLeftTextOriginX,

    ptLowerLeftTextOriginY,

    intFontFace,

    fltFontScale,

    intFontThickness,

    textSize,

) = center_text_at_certain_size_at_a_specific_point(

    img,

    "Number 2",

    maxwidth,

    maxheight,

    wheretoput=(100, 100),

    color=(255, 255, 0),

    add_thickness_each=10,

)



imgresult3 = putTrueTypeText(

    img=img,

    text="Number 3",

    org=(100, 100),

    fontFace=r"C:\Windows\Fonts\ANTQUAB.TTF",

    fontScale=56,

    color=(255, 255, 0),

)





ia = put_ttf_font_at_exact_location_with_exact_size(

    image=img,

    text="Number 4",

    coords=(59, 300),

    color=(100, 0, 100),

    font=r"C:\Windows\Fonts\ANTQUAB.TTF",

    maxwidth=300,

    maxheight=100,

    fonttransparency=100,

)



ia1 = put_ttf_font_in_box_at_exact_location_with_exact_size(

    image=img,

    text="Number 5",

    coords=(59, 300),

    color=(100, 0, 100),

    font=r"C:\Windows\Fonts\ANTQUAB.TTF",

    maxwidth=300,

    maxheight=100,

    fonttransparency=0,

    boxtransparency=0.7,

    boxcolor=(255, 0, 0),

)



ia2 = put_ttf_font_in_circle_at_exact_location_with_exact_size(

    image=img,

    text="Number 6",

    coords=(59, 300),

    color=(100, 0, 100),

    font=r"C:\Windows\Fonts\ANTQUAB.TTF",

    maxwidth=300,

    maxheight=100,

    fonttransparency=50,

    circletransparency=0.2,

    circlecolor=(255, 0, 0),

)





ia3 = put_ttf_font_multiline_in_box_at_exact_location_with_exact_size(

    image=img,

    textwithnewline="Number 7\nNumber 7\nNumber 7",

    coords=(59, 10),

    color=(100, 0, 100),

    font=r"C:\Windows\Fonts\ANTQUAB.TTF",

    maxwidth=600,

    maxheight=600,

    fonttransparency=50,

    boxtransparency=0.2,

    boxcolor=(255, 0, 0),

    boxborder=20,

)





ia4 = put_ttf_font_multiline_at_exact_location_with_exact_size(

    image=img,

    textwithnewline="Number 8\nNumber 8\nNumber 8",

    coords=(59, 10),

    color=(100, 0, 100),

    font=r"C:\Windows\Fonts\ANTQUAB.TTF",

    maxwidth=600,

    maxheight=600,

    fonttransparency=50,

)





ia5 = put_ttf_font_multiline_at_exact_center_location_with_exact_size(

    image=img,

    textwithnewline="Number 9\nNumber 9\nNumber 9",

    coords=(300, 300),

    color=(255, 255, 210),

    font=r"C:\Windows\Fonts\ANTQUAB.TTF",

    maxwidth=300,

    maxheight=100,

    fonttransparency=-1,

)





ia6 = put_ttf_font_multiline_in_box_at_exact_center_location_with_exact_size(

    image=img,

    textwithnewline="Number 10\nNumber 10\nNumber 10",

    coords=(300, 300),

    color=(255, 255, 210),

    font=r"C:\Windows\Fonts\ANTQUAB.TTF",

    maxwidth=300,

    maxheight=100,

    fonttransparency=50,

    boxtransparency=0.2,

    boxcolor=(255, 0, 0),

    boxborder=20,

)





allimgs=    [

        imgresult1,

        imgresult2,

        imgresult3,

        ia["result"],

        ia1["result"],

        ia2["result"],

        ia3["result"],

        ia4["result"],

        ia5["result"],

        ia6["result"],



    ]

for i,b in enumerate(allimgs):

    save_cv_image(os.path.join('f:\\alltextimgs',str(i).zfill(6) + '.png'), b)

Metadata

Release files for a-cv2-text-effects 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 a-cv2-text-effects 0.10
File Size Uploaded Provenance Actions
a_cv2_text_effects-0.10.tar.gz 10.7 kB Without provenance Details for a_cv2_text_effects-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for a-cv2-text-effects 0.10
File Interpreter ABI Platform Actions
a_cv2_text_effects-0.10-py3-none-any.whl Python 3 none any Details for a_cv2_text_effects-0.10-py3-none-any.whl

Total release size: 22.0 kB

Release files / a_cv2_text_effects-0.10.tar.gz

Download URL a_cv2_text_effects-0.10.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a2e8676b201b4e3863b70d8862135cc851bca7f7a555c611fbeb63b56c4e0c15
BLAKE2b-256 checksum
How to use checksums
86590bd89445ca6c1f133ea2e2c87503299c9ca552bd1ca712241e0782617b13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

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

Download URL a_cv2_text_effects-0.10-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fbcff78343f6d11b02d5a38a196fe357a4760e21d9ee9d43c08452d1551f712
BLAKE2b-256 checksum
How to use checksums
7ae164ae7135e12aa7c5d59e5d610880becbf22a857c8f68206ff972b5193916
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Security for a-cv2-text-effects 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