From b450998f3f87f3a123d06b728c04c3038596c9fe Mon Sep 17 00:00:00 2001 From: passthem Date: Fri, 7 Nov 2025 21:15:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A9=E8=B1=86=E5=8C=85=E6=B0=B4=E5=8D=B0?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9B=B8=E5=AF=B9=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- konabot/plugins/memepack/drawing/watermark.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/konabot/plugins/memepack/drawing/watermark.py b/konabot/plugins/memepack/drawing/watermark.py index 9b1e02d..db0fba1 100644 --- a/konabot/plugins/memepack/drawing/watermark.py +++ b/konabot/plugins/memepack/drawing/watermark.py @@ -4,12 +4,17 @@ import PIL.Image from konabot.common.path import ASSETS_PATH from konabot.common.utils.to_async import make_async -doubao_watermark = PIL.Image.open(ASSETS_PATH / "img" / "meme" / "doubao.png").convert("RGBA").resize((140, 40)) +doubao_watermark = PIL.Image.open(ASSETS_PATH / "img" / "meme" / "doubao.png").convert("RGBA") @make_async def draw_doubao_watermark(base: PIL.Image.Image) -> PIL.Image.Image: base = base.copy().convert("RGBA") - base.alpha_composite(doubao_watermark, (base.size[0] - 160, base.size[1] - 60)) + w = base.size[0] / 768 * 140 + h = base.size[0] / 768 * 40 + x = base.size[0] / 768 * 160 + y = base.size[0] / 768 * 60 + w, h, x, y = map(int, (w, h, x, y)) + base.alpha_composite(doubao_watermark.resize((w, h)), (base.size[0] - x, base.size[1] - y)) return base