From 36b13e7d3de9af582a88a1a5b2a3c29be3d40d54 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Thu, 17 Nov 2022 11:10:45 -0800 Subject: + update --- exif.py | 2 -- square.py | 10 ++-------- 2 files changed, 2 insertions(+), 10 deletions(-) mode change 100644 => 100755 square.py diff --git a/exif.py b/exif.py index 15fd059..7ae3cc5 100644 --- a/exif.py +++ b/exif.py @@ -5,8 +5,6 @@ import sys def rename(month): - # base_directory = pathlib.Path("/mnt/nas/Photo/RAW/2022/") - # base_directory = pathlib.Path("/run/user/1000/kio-fuse-rQvVbo/smb/192.168.1.77/NAS/Photo/RAW/2022/") base_directory = pathlib.Path("/mnt/c/Users/clarkzjw/Desktop/") directory = str(base_directory.joinpath(month).absolute()) + "/" diff --git a/square.py b/square.py old mode 100644 new mode 100755 index fcc5fab..903e939 --- a/square.py +++ b/square.py @@ -18,7 +18,7 @@ def insta_size_padding(img): padding_percentage = 0.02 length = max(w, h) padding = int(padding_percentage * length) - new = Image.new(img.mode, (length + 2 * padding, length + 2 * padding), 0xeeeeee) + new = Image.new(img.mode, (length + 2 * padding, length + 2 * padding), 0xFAFAFA) if h >= w: new.paste(img, (int((length + 2 * padding - w) / 2), padding)) else: @@ -41,8 +41,6 @@ def drop_shadow(image, offset=(5, 5), background=0xffffff, shadow=0x444444, bord produce a more blurred shadow, but increase processing time. """ - # Create the backdrop image -- a box in the background colour with a - # shadow on it. w, h = image.size total_width = w + abs(offset[0]) + 2 * border @@ -50,19 +48,15 @@ def drop_shadow(image, offset=(5, 5), background=0xffffff, shadow=0x444444, bord 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) shadow_top = border + max(offset[1], 0) back.paste(shadow_image, (shadow_left, shadow_top)) - # Apply the filter to blur the edges of the shadow. Since a small kernel - # is used, the filter must be applied repeatedly to get a decent blur. n = 0 while n < iterations: back = back.filter(ImageFilter.BLUR) n += 1 - # Paste the input image onto the shadow backdrop image_left = border - min(offset[0], 0) image_top = border - min(offset[1], 0) back.paste(image, (image_left, image_top)) @@ -81,5 +75,5 @@ if __name__ == "__main__": except Exception as e: print(str(e)) continue - result = insta_size_padding(drop_shadow(im, background=0xeeeeee, shadow=0x444444, offset=(20, 20))) + result = insta_size_no_padding(drop_shadow(im, background=0xFAFAFA, shadow=0x444444, offset=(20, 20))) result.save("{}-square-shadow.{}".format(names[0], names[1]), quality=100) -- cgit v1.2.3