lock aja pusing

This commit is contained in:
yasirarism 2023-07-03 21:42:01 +07:00 committed by GitHub
parent 220a7ed493
commit 2b26bde7a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -1,4 +1,4 @@
import textwrap, logging import textwrap
from asyncio import gather from asyncio import gather
from os import remove as hapus from os import remove as hapus
@ -11,7 +11,6 @@ from misskaty.core.decorator.ratelimiter import ratelimiter
from misskaty.helper.localization import use_chat_lang from misskaty.helper.localization import use_chat_lang
from misskaty.vars import COMMAND_HANDLER from misskaty.vars import COMMAND_HANDLER
LOGGER = logging.getLogger(__name__)
async def draw_meme_text(image_path, text): async def draw_meme_text(image_path, text):
img = Image.open(image_path) img = Image.open(image_path)
@ -29,7 +28,8 @@ async def draw_meme_text(image_path, text):
current_h, pad = 10, 5 current_h, pad = 10, 5
if upper_text: if upper_text:
for u_text in textwrap.wrap(upper_text, width=15): for u_text in textwrap.wrap(upper_text, width=15):
u_width, u_height = str(draw.textlength(text=u_text, font=m_font)).split(".") u_width, u_height = draw.textsize(u_text, font=m_font)
draw.text( draw.text(
xy=(((i_width - u_width) / 2) - 1, int((current_h / 640) * i_width)), xy=(((i_width - u_width) / 2) - 1, int((current_h / 640) * i_width)),
text=u_text, text=u_text,
@ -72,7 +72,7 @@ async def draw_meme_text(image_path, text):
current_h += u_height + pad current_h += u_height + pad
if lower_text: if lower_text:
for l_text in textwrap.wrap(lower_text, width=15): for l_text in textwrap.wrap(lower_text, width=15):
u_width, u_height = str(draw.textlength(text=l_text, font=m_font)).split(".") u_width, u_height = draw.textsize(l_text, font=m_font)
draw.text( draw.text(
xy=( xy=(

View file

@ -18,7 +18,7 @@ psutil
python-dateutil python-dateutil
telegraph telegraph
hachoir hachoir
Pillow==10.0.0 Pillow==9.5.0
httpx[http2] httpx[http2]
git+https://github.com/yasirarism/vcsi git+https://github.com/yasirarism/vcsi
git+https://github.com/yasirarism/iytdl git+https://github.com/yasirarism/iytdl