added blur to dropshadow

This commit is contained in:
Fredrick W. Warren 2022-05-30 10:52:33 -07:00
parent 2eb0e49eec
commit 6363327c5e

View File

@ -10,7 +10,7 @@ def update_image(original, title, subtitle):
renders text on full sized slide
make half sized copy for preview and fill top/bottom with white.
"""
# Render Text
# render text
image = Image.new(mode="RGBA", size=(1280,720))
font1 = ImageFont.truetype('tahomabd.ttf', 50)
font2 = ImageFont.truetype('tahomabd.ttf', 38)
@ -20,7 +20,7 @@ def update_image(original, title, subtitle):
draw.text((20,588), subtitle, font=font2, fill='white',
stroke_width=4, stroke_fill='black', spacing=4)
# Render Drop Shadow
# render drop dhadow
dropshadow = Image.new(mode="RGBA", size=(1280,720))
font1 = ImageFont.truetype('tahomabd.ttf', 50)
font2 = ImageFont.truetype('tahomabd.ttf', 38)
@ -30,6 +30,11 @@ def update_image(original, title, subtitle):
draw.text((25,593), subtitle, font=font2, fill='black',
stroke_width=4, stroke_fill='black', spacing=4)
# apply blur
for i in range(6):
dropshadow = dropshadow.filter(ImageFilter.BLUR)
background = Image.alpha_composite(original, dropshadow)
background = Image.alpha_composite(background, image)
return background