scale and crop image to be returned as a thumbnail

This commit is contained in:
Fredrick W. Warren 2022-05-30 09:20:03 -07:00
parent a462f169e4
commit 7d87b428b1

View File

@ -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