From 7d87b428b1c4112f80bc3fb6fd8d612fd2a5c6e3 Mon Sep 17 00:00:00 2001 From: "Fredrick W. Warren" Date: Mon, 30 May 2022 09:20:03 -0700 Subject: [PATCH] scale and crop image to be returned as a thumbnail --- hcatitles.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hcatitles.py b/hcatitles.py index 63fbffa..80508ea 100644 --- a/hcatitles.py +++ b/hcatitles.py @@ -20,11 +20,12 @@ def update_image(original, title, subtitle): def update_thumbnail(image): """genreate thumbnail from original image""" - """454-720""" - thumbnail = image.resize((720, 360)) - white = (255, 255, 255, 255) - ImageDraw.floodfill(thumbnail, (5,5), value=white) - ImageDraw.floodfill(thumbnail, (5,355), value=white) + """454-720 scales to 227-360""" + scaled = image.resize((720, 360)) + # white = (255, 255, 255, 255) + # ImageDraw.floodfill(scaled, (5, 5), value=white) + # ImageDraw.floodfill(scaled, (5, 355), value=white) + thumbnail = scaled.crop((0, 255, 719, 359)) return thumbnail