From 6363327c5eca3ff236d5c44eec74440e9ea1e040 Mon Sep 17 00:00:00 2001 From: "Fredrick W. Warren" Date: Mon, 30 May 2022 10:52:33 -0700 Subject: [PATCH] added blur to dropshadow --- hcatitles.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hcatitles.py b/hcatitles.py index 3dbb9d7..f55b384 100644 --- a/hcatitles.py +++ b/hcatitles.py @@ -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