mirror of
https://github.com/artegoser/image-pluser-webui.git
synced 2024-11-21 19:36:21 +03:00
feat: sharpen method
This commit is contained in:
parent
45916cd320
commit
8d9f2a8a17
3 changed files with 21 additions and 10 deletions
|
@ -7,3 +7,8 @@ def canny_edge(file_name):
|
|||
image = image.convert("L")
|
||||
|
||||
return image.filter(ImageFilter.FIND_EDGES)
|
||||
|
||||
|
||||
def sharpen(file_name):
|
||||
image = Image.open(file_name)
|
||||
return image.filter(ImageFilter.SHARPEN)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import ffmpeg
|
||||
import os
|
||||
from processing.utils import generate_name, get_date_text, generate_name_with_file_name
|
||||
from methods.bulk_methods import canny_edge
|
||||
from methods.bulk_methods import canny_edge, sharpen
|
||||
|
||||
|
||||
def images_to_video(directory, fps, img_ext, img_name_format, video_name, video_ext, video_dir):
|
||||
|
@ -29,8 +29,14 @@ def video_to_images(video_path, img_ext):
|
|||
def bulk_processing(directory, out_directory, method):
|
||||
date = get_date_text()
|
||||
if method == "canny edge":
|
||||
run_bulk(canny_edge, directory, out_directory, date)
|
||||
elif method == "sharpen":
|
||||
run_bulk(sharpen, directory, out_directory, date)
|
||||
|
||||
|
||||
def run_bulk(func, directory, out_directory, date):
|
||||
for file in os.listdir(directory):
|
||||
img = canny_edge(os.path.join(directory, file))
|
||||
img = func(os.path.join(directory, file))
|
||||
if out_directory:
|
||||
img_out_path = os.path.join(out_directory, file)
|
||||
else:
|
||||
|
|
|
@ -9,7 +9,7 @@ with gr.Blocks() as app:
|
|||
directory = gr.Text(
|
||||
placeholder="A directory with many images.", lines=1, label="Directory")
|
||||
method = gr.Dropdown(
|
||||
choices=["canny edge"], value="canny edge", label="Method")
|
||||
choices=["canny edge", "sharpen"], value="canny edge", label="Method")
|
||||
|
||||
with gr.Accordion("Advanced settings", open=False) as acc:
|
||||
out_dir = gr.Text(
|
||||
|
|
Loading…
Add table
Reference in a new issue