File size: 520 Bytes
3b8ad4d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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)
|