mirror of
https://github.com/artegoser/image-pluser-webui.git
synced 2024-11-24 04:36:20 +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):
|
def edge(file_name):
|
||||||
image = Image.open(file_name)
|
image = Image.open(file_name)
|
||||||
|
|
||||||
image = image.convert("L")
|
image = image.convert("L")
|
||||||
|
|
||||||
return image.filter(ImageFilter.FIND_EDGES)
|
return image.filter(ImageFilter.FIND_EDGES)
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,6 +17,16 @@ def canny_edge(file_name):
|
||||||
return Image.fromarray(feature.canny(image, sigma=2))
|
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):
|
def sharpen(file_name):
|
||||||
image = Image.open(file_name)
|
image = Image.open(file_name)
|
||||||
return image.filter(ImageFilter.SHARPEN)
|
return image.filter(ImageFilter.SHARPEN)
|
||||||
|
@ -28,6 +36,8 @@ methods_funcs = {
|
||||||
"Sharpen": sharpen,
|
"Sharpen": sharpen,
|
||||||
"Edge detection": edge,
|
"Edge detection": edge,
|
||||||
"Canny edge detection": canny_edge,
|
"Canny edge detection": canny_edge,
|
||||||
|
"Grayscale": grayscale,
|
||||||
|
"Blur": blur,
|
||||||
}
|
}
|
||||||
|
|
||||||
methods = list(methods_funcs.keys())
|
methods = list(methods_funcs.keys())
|
||||||
|
|
Loading…
Add table
Reference in a new issue