renamed image to text

This commit is contained in:
Fredrick W. Warren 2022-05-30 11:10:23 -07:00
parent 94a610c1a6
commit c0f221aa7c

View File

@ -11,10 +11,10 @@ def update_image(original, title, subtitle):
make half sized copy for preview and fill top/bottom with white. make half sized copy for preview and fill top/bottom with white.
""" """
# render text # render text
image = Image.new(mode="RGBA", size=(1280,720)) text = 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(text)
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',
@ -39,8 +39,9 @@ def update_image(original, title, subtitle):
alpha = ImageEnhance.Brightness(alpha).enhance(.9) alpha = ImageEnhance.Brightness(alpha).enhance(.9)
dropshadow.putalpha(alpha) dropshadow.putalpha(alpha)
# merge dropshdow then text layer onto background
background = Image.alpha_composite(original, dropshadow) background = Image.alpha_composite(original, dropshadow)
background = Image.alpha_composite(background, image) background = Image.alpha_composite(background, text)
return background return background
def update_thumbnail(image): def update_thumbnail(image):