aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--square.py10
1 files 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
43 43
44 # Create the backdrop image -- a box in the background colour with a 44 # Create the backdrop image -- a box in the background colour with a
45 # shadow on it. 45 # shadow on it.
46 total_width = image.size[0] + abs(offset[0]) + 2 * border 46 w, h = image.size
47 total_height = image.size[1] + abs(offset[1]) + 2 * border
48 back = Image.new(image.mode, (total_width, total_height), background)
49 47
50 shadow_image = Image.new(image.mode, (image.size[0], image.size[1]), shadow) 48 total_width = w + abs(offset[0]) + 2 * border
49 total_height = h + abs(offset[1]) + 2 * border
50 back = Image.new(image.mode, (total_width, total_height), background)
51 shadow_image = Image.new(image.mode, (w, h), shadow)
51 52
52 # Place the shadow, taking into account the offset from the image 53 # Place the shadow, taking into account the offset from the image
53 shadow_left = border + max(offset[0], 0) 54 shadow_left = border + max(offset[0], 0)
@@ -65,7 +66,6 @@ def drop_shadow(image, offset=(5, 5), background=0xffffff, shadow=0x444444, bord
65 image_left = border - min(offset[0], 0) 66 image_left = border - min(offset[0], 0)
66 image_top = border - min(offset[1], 0) 67 image_top = border - min(offset[1], 0)
67 back.paste(image, (image_left, image_top)) 68 back.paste(image, (image_left, image_top))
68
69 return back 69 return back
70 70
71 71
Powered by cgit v1.2.3 (git 2.41.0)