From 995481f43737fa064de0abf1ee6a5173492037c5 Mon Sep 17 00:00:00 2001 From: Artemy Egorov Date: Wed, 26 Apr 2023 19:04:08 +0300 Subject: [PATCH] feat: bulk blur, bulk grayscale --- methods/bulk_methods.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/methods/bulk_methods.py b/methods/bulk_methods.py index 01deb97..20b1a00 100644 --- a/methods/bulk_methods.py +++ b/methods/bulk_methods.py @@ -5,9 +5,7 @@ import numpy as np def edge(file_name): image = Image.open(file_name) - image = image.convert("L") - return image.filter(ImageFilter.FIND_EDGES) @@ -19,6 +17,16 @@ def canny_edge(file_name): return Image.fromarray(feature.canny(image, sigma=2)) +def blur(file_name): + image = Image.open(file_name) + return image.filter(ImageFilter.BLUR) + + +def grayscale(file_name): + image = Image.open(file_name) + return image.convert("L") + + def sharpen(file_name): image = Image.open(file_name) return image.filter(ImageFilter.SHARPEN) @@ -28,6 +36,8 @@ methods_funcs = { "Sharpen": sharpen, "Edge detection": edge, "Canny edge detection": canny_edge, + "Grayscale": grayscale, + "Blur": blur, } methods = list(methods_funcs.keys())