write borderd text to own layer before merging down

This commit is contained in:
Fredrick W. Warren 2022-05-30 10:09:54 -07:00
parent f7a6571762
commit b05cad5c56

View File

@ -10,15 +10,17 @@ def update_image(original, title, subtitle):
renders text on full sized slide renders text on full sized slide
make half sized copy for preview and fill top/bottom with white. make half sized copy for preview and fill top/bottom with white.
""" """
image = original background = original
image = Image.new(mode="RGBA", size=(1280,720))
font1 = ImageFont.truetype('tahomabd.ttf', 50) font1 = ImageFont.truetype('tahomabd.ttf', 50)
font2 = ImageFont.truetype('tahomabd.ttf', 38) font2 = ImageFont.truetype('tahomabd.ttf', 38)
draw = ImageDraw.Draw(image) draw = ImageDraw.Draw(image)
draw.text((20,520), title, font=font1, fill='white', draw.text((20,520), title, font=font1, fill='white',
stroke_width=4, stroke_fill='black', spacing=4) stroke_width=4, stroke_fill='black', spacing=4)
draw.text((20,588), subtitle, font=font2, fill='white', draw.text((20,588), subtitle, font=font2, fill='white',
stroke_width=3, stroke_fill='black', spacing=4) stroke_width=4, stroke_fill='black', spacing=4)
return image background.paste(image, (0,0), image)
return background
def update_thumbnail(image): def update_thumbnail(image):
"""genreate thumbnail from original image""" """genreate thumbnail from original image"""