From 60509a72b65f41d95729539a98aa7e595a96e24c Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Fri, 30 Sep 2022 23:00:42 -0700 Subject: + fix --- square.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/square.py b/square.py index de4d678..fcc5fab 100644 --- a/square.py +++ b/square.py @@ -43,11 +43,12 @@ def drop_shadow(image, offset=(5, 5), background=0xffffff, shadow=0x444444, bord # Create the backdrop image -- a box in the background colour with a # shadow on it. - total_width = image.size[0] + abs(offset[0]) + 2 * border - total_height = image.size[1] + abs(offset[1]) + 2 * border - back = Image.new(image.mode, (total_width, total_height), background) + w, h = image.size - shadow_image = Image.new(image.mode, (image.size[0], image.size[1]), shadow) + total_width = w + abs(offset[0]) + 2 * border + total_height = h + abs(offset[1]) + 2 * border + back = Image.new(image.mode, (total_width, total_height), background) + shadow_image = Image.new(image.mode, (w, h), shadow) # Place the shadow, taking into account the offset from the image shadow_left = border + max(offset[0], 0) @@ -65,7 +66,6 @@ def drop_shadow(image, offset=(5, 5), background=0xffffff, shadow=0x444444, bord image_left = border - min(offset[0], 0) image_top = border - min(offset[1], 0) back.paste(image, (image_left, image_top)) - return back -- cgit v1.2.3