Files
konabot/konabot/plugins/memepack/drawing/geimao.py
passthem 6362ed4a88
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
补全 Emoji 显示和另一个显示
2025-09-29 18:09:28 +08:00

29 lines
839 B
Python

import asyncio
from typing import Any, cast
import imagetext_py
import PIL.Image
from .base.fonts import HARMONYOS_SANS_SC_BLACK
from .base.path import ASSETS
geimao_image = PIL.Image.open(ASSETS / "geimao.jpg").convert("RGBA")
def _draw_geimao(saying: str):
img = geimao_image.copy()
with imagetext_py.Writer(img) as iw:
iw.draw_text_wrapped(
saying, 960, 50, 00.5, 0, 1920, 240, HARMONYOS_SANS_SC_BLACK,
imagetext_py.Paint.Color(imagetext_py.Color.from_hex("000000FF")),
0.8,
imagetext_py.TextAlign.Center,
cast(Any, 30.0),
imagetext_py.Paint.Color(imagetext_py.Color.from_hex("FFFFFFFF")),
draw_emojis=True,
)
return img
async def draw_geimao(saying: str):
return await asyncio.to_thread(_draw_geimao, saying)