Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 62f4195e46 | |||
| 751297e3bc | |||
| b450998f3f |
@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user