mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-25 15:55:18 +00:00
Changed flag to new node
This commit is contained in:
parent
e5318d918c
commit
6a6256a75c
38
nodes.py
38
nodes.py
@ -775,14 +775,13 @@ class KSamplerAdvanced:
|
|||||||
class SaveImage:
|
class SaveImage:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.output_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "output")
|
self.output_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "output")
|
||||||
self.temp_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "temp")
|
self.url_suffix = ""
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
return {"required":
|
return {"required":
|
||||||
{"images": ("IMAGE", ),
|
{"images": ("IMAGE", ),
|
||||||
"filename_prefix": ("STRING", {"default": "ComfyUI"}),
|
"filename_prefix": ("STRING", {"default": "ComfyUI"}),},
|
||||||
"use_temp_file": (["yes", "no"], {"default" : "no"} ),},
|
|
||||||
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,6 +809,9 @@ class SaveImage:
|
|||||||
os.mkdir(self.output_dir)
|
os.mkdir(self.output_dir)
|
||||||
counter = 1
|
counter = 1
|
||||||
|
|
||||||
|
if not os.path.exists(self.output_dir):
|
||||||
|
os.makedirs(self.output_dir)
|
||||||
|
|
||||||
paths = list()
|
paths = list()
|
||||||
for image in images:
|
for image in images:
|
||||||
i = 255. * image.cpu().numpy()
|
i = 255. * image.cpu().numpy()
|
||||||
@ -820,25 +822,24 @@ class SaveImage:
|
|||||||
if extra_pnginfo is not None:
|
if extra_pnginfo is not None:
|
||||||
for x in extra_pnginfo:
|
for x in extra_pnginfo:
|
||||||
metadata.add_text(x, json.dumps(extra_pnginfo[x]))
|
metadata.add_text(x, json.dumps(extra_pnginfo[x]))
|
||||||
|
|
||||||
file = f"{filename_prefix}_{counter:05}_.png"
|
file = f"{filename_prefix}_{counter:05}_.png"
|
||||||
|
img.save(os.path.join(self.output_dir, file), pnginfo=metadata, optimize=True)
|
||||||
if use_temp_file == "yes":
|
paths.append(file + self.url_suffix)
|
||||||
if not os.path.exists(self.temp_dir):
|
|
||||||
os.makedirs(self.temp_dir)
|
|
||||||
dir = self.temp_dir
|
|
||||||
else:
|
|
||||||
dir = self.output_dir
|
|
||||||
|
|
||||||
img.save(os.path.join(dir, file), pnginfo=metadata, optimize=True)
|
|
||||||
|
|
||||||
if use_temp_file == "yes":
|
|
||||||
file += "?type=temp"
|
|
||||||
|
|
||||||
paths.append(file)
|
|
||||||
counter += 1
|
counter += 1
|
||||||
return { "ui": { "images": paths } }
|
return { "ui": { "images": paths } }
|
||||||
|
|
||||||
|
class PreviewImage(SaveImage):
|
||||||
|
def __init__(self):
|
||||||
|
self.output_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "temp")
|
||||||
|
self.url_suffix = "?type=temp"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(s):
|
||||||
|
return {"required":
|
||||||
|
{"images": ("IMAGE", ), },
|
||||||
|
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
||||||
|
}
|
||||||
|
|
||||||
class LoadImage:
|
class LoadImage:
|
||||||
input_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "input")
|
input_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "input")
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -959,6 +960,7 @@ NODE_CLASS_MAPPINGS = {
|
|||||||
"EmptyLatentImage": EmptyLatentImage,
|
"EmptyLatentImage": EmptyLatentImage,
|
||||||
"LatentUpscale": LatentUpscale,
|
"LatentUpscale": LatentUpscale,
|
||||||
"SaveImage": SaveImage,
|
"SaveImage": SaveImage,
|
||||||
|
"PreviewImage": PreviewImage,
|
||||||
"LoadImage": LoadImage,
|
"LoadImage": LoadImage,
|
||||||
"LoadImageMask": LoadImageMask,
|
"LoadImageMask": LoadImageMask,
|
||||||
"ImageScale": ImageScale,
|
"ImageScale": ImageScale,
|
||||||
|
Loading…
Reference in New Issue
Block a user