mirror of
https://github.com/artegoser/image-pluser-webui.git
synced 2024-11-05 20:23:58 +03:00
feat: bulk blur, bulk grayscale
This commit is contained in:
parent
7742416a53
commit
995481f437
1 changed files with 12 additions and 2 deletions
|
@ -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())
|
||||
|
|
Loading…
Reference in a new issue