mirror of
https://github.com/artegoser/image-pluser-webui.git
synced 2024-11-06 04:33:57 +03:00
30 lines
776 B
Python
30 lines
776 B
Python
from methods.stack_methods import denoise, startracks, noise_extractor, untrack
|
|
import os
|
|
import datetime
|
|
|
|
|
|
def generate_name():
|
|
os.makedirs("./output/stacked", exist_ok=True)
|
|
|
|
return f"./output/stacked/{datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}.png"
|
|
|
|
|
|
def stacking(dir, method):
|
|
|
|
files = os.listdir(dir)
|
|
files = list(map(lambda x: os.path.join(dir, x), files))
|
|
files = list(filter(lambda x: x.endswith(".png"), files))
|
|
|
|
if method == "denoise":
|
|
img = denoise(files)
|
|
elif method == "startracks":
|
|
img = startracks(files)
|
|
elif method == "noise extractor":
|
|
img = noise_extractor(files)
|
|
elif method == "untrack":
|
|
img = untrack(files)
|
|
|
|
name = generate_name()
|
|
img.save(name)
|
|
|
|
return [name]
|