28 lines
719 B
Python
28 lines
719 B
Python
import asyncio
|
|
|
|
import imagetext_py
|
|
import PIL.Image
|
|
|
|
from konabot.common.path import ASSETS_PATH
|
|
|
|
from .base.fonts import HARMONYOS_SANS_SC_REGULAR
|
|
|
|
pt_image = PIL.Image.open(ASSETS_PATH / "img" / "meme" / "ptsay.png").convert("RGBA")
|
|
|
|
|
|
def _draw_pt(saying: str):
|
|
img = pt_image.copy()
|
|
with imagetext_py.Writer(img) as iw:
|
|
iw.draw_text_wrapped(
|
|
saying, 259, 278, 0.5, 0.5, 360, 48, HARMONYOS_SANS_SC_REGULAR,
|
|
imagetext_py.Paint.Color(imagetext_py.Color.from_hex("000000FF")),
|
|
1.0,
|
|
imagetext_py.TextAlign.Center,
|
|
draw_emojis=True,
|
|
)
|
|
return img
|
|
|
|
|
|
async def draw_pt(saying: str):
|
|
return await asyncio.to_thread(_draw_pt, saying)
|