it / image /watermark.py
fomext's picture
Upload 6 files
3b8ad4d verified
Raw
History Blame Contribute Delete
520 Bytes
from PIL import Image, ImageDraw, ImageFont
def add_qr_to_background(img_path, output_path, qr_img):
img = Image.open(img_path).convert("RGBA")
qr_x = img.width - qr_img.width - 24
qr_y = img.height - qr_img.height - 48
img.paste(qr_img, (qr_x, qr_y), qr_img)
draw = ImageDraw.Draw(img)
font = ImageFont.load_default()
draw.text(
(qr_x, qr_y + qr_img.height + 6),
"Lyric Video Maker",
fill=(255, 255, 255, 180),
font=font
)
img.save(output_path)