Imagetext-py

Latest version: v2.2.0

Safety actively analyzes 623395 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

256.0256.0

im = Image.open("unknown.png").convert("RGBA")


with Writer(im) as w:
w.draw_text_wrapped(
text="hello from python πŸ˜“ lol, s<:blobpain:739614945045643447><:chad:682819256173461522><:bigbrain:744344773229543495> emojis workin",
x=256, y=256,
ax=0.5, ay=0.5,
width=512,
size=67,
font=font,
fill=black,
align=TextAlign.Center,
stroke=2.0,
stroke_color=rainbow,
draw_emojis=True
)

im.save("test.png")


Bug Fixes:
- Fixed text wrapping algo (no more missing words)
- Fixed some incorrect python types

2.1.0

- added support for character or word-bound text wrapping
- overhaul to underlying text layout and wrapping for emojis resulting in some great speedups
- fixed incorrect text size being returned.

2.0.1

Added a new global font databse
py
from PIL import Image
from imagetext_py import *

FontDB.SetDefaultEmojiOptions(EmojiOptions(allow_discord=True))
FontDB.LoadFromDir(".")

font = FontDB.Query("coolvetica japanese")

with Image.new("RGBA", (512, 512), "white") as im:
with Writer(im) as w:
w.draw_text_wrapped(
text="hello from python πŸ˜“ lol, <:blobpain:739614945045643447> " \
"ほまみ <:chad:682819256173461522><:bigbrain:744344773229543495> " \
"emojis workin",
x=256, y=256,
ax=0.5, ay=0.5,
width=512,
size=90,
font=font,
fill=Paint.Color((0, 0, 0, 255)),
align=TextAlign.Center,
stroke=2.0,
stroke_color=Paint.Rainbow((0.0,0.0), (256.0,256.0)),
draw_emojis=True
)
im.save("test.png")

2.0.0

Added support for drawing emojis, from multiple sources including discord!

Example use case with `Writer`
py
from PIL import Image
from imagetext_py import *

e_options = EmojiOptions(allow_discord=True)
font = Font("coolvetica.ttf", fallbacks=["japanese.otf"], emoji_options=e_options)

black = Paint.Color((0, 0, 0, 255))

1.0.0

...

Links

Releases

Β© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.