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