|
|
|
@ -777,7 +777,7 @@ class KSamplerAdvanced:
|
|
|
|
|
|
|
|
|
|
class SaveImage: |
|
|
|
|
def __init__(self): |
|
|
|
|
self.output_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "output") |
|
|
|
|
self.output_dir = folder_paths.get_output_directory() |
|
|
|
|
self.type = "output" |
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
@ -829,9 +829,6 @@ class SaveImage:
|
|
|
|
|
os.makedirs(full_output_folder, exist_ok=True) |
|
|
|
|
counter = 1 |
|
|
|
|
|
|
|
|
|
if not os.path.exists(self.output_dir): |
|
|
|
|
os.makedirs(self.output_dir) |
|
|
|
|
|
|
|
|
|
results = list() |
|
|
|
|
for image in images: |
|
|
|
|
i = 255. * image.cpu().numpy() |
|
|
|
@ -856,7 +853,7 @@ class SaveImage:
|
|
|
|
|
|
|
|
|
|
class PreviewImage(SaveImage): |
|
|
|
|
def __init__(self): |
|
|
|
|
self.output_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "temp") |
|
|
|
|
self.output_dir = folder_paths.get_temp_directory() |
|
|
|
|
self.type = "temp" |
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
@ -867,13 +864,11 @@ class PreviewImage(SaveImage):
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class LoadImage: |
|
|
|
|
input_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "input") |
|
|
|
|
@classmethod |
|
|
|
|
def INPUT_TYPES(s): |
|
|
|
|
if not os.path.exists(s.input_dir): |
|
|
|
|
os.makedirs(s.input_dir) |
|
|
|
|
input_dir = folder_paths.get_input_directory() |
|
|
|
|
return {"required": |
|
|
|
|
{"image": (sorted(os.listdir(s.input_dir)), )}, |
|
|
|
|
{"image": (sorted(os.listdir(input_dir)), )}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
CATEGORY = "image" |
|
|
|
@ -881,7 +876,8 @@ class LoadImage:
|
|
|
|
|
RETURN_TYPES = ("IMAGE", "MASK") |
|
|
|
|
FUNCTION = "load_image" |
|
|
|
|
def load_image(self, image): |
|
|
|
|
image_path = os.path.join(self.input_dir, image) |
|
|
|
|
input_dir = folder_paths.get_input_directory() |
|
|
|
|
image_path = os.path.join(input_dir, image) |
|
|
|
|
i = Image.open(image_path) |
|
|
|
|
image = i.convert("RGB") |
|
|
|
|
image = np.array(image).astype(np.float32) / 255.0 |
|
|
|
@ -895,18 +891,19 @@ class LoadImage:
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
def IS_CHANGED(s, image): |
|
|
|
|
image_path = os.path.join(s.input_dir, image) |
|
|
|
|
input_dir = folder_paths.get_input_directory() |
|
|
|
|
image_path = os.path.join(input_dir, image) |
|
|
|
|
m = hashlib.sha256() |
|
|
|
|
with open(image_path, 'rb') as f: |
|
|
|
|
m.update(f.read()) |
|
|
|
|
return m.digest().hex() |
|
|
|
|
|
|
|
|
|
class LoadImageMask: |
|
|
|
|
input_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "input") |
|
|
|
|
@classmethod |
|
|
|
|
def INPUT_TYPES(s): |
|
|
|
|
input_dir = folder_paths.get_input_directory() |
|
|
|
|
return {"required": |
|
|
|
|
{"image": (sorted(os.listdir(s.input_dir)), ), |
|
|
|
|
{"image": (sorted(os.listdir(input_dir)), ), |
|
|
|
|
"channel": (["alpha", "red", "green", "blue"], ),} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -915,7 +912,8 @@ class LoadImageMask:
|
|
|
|
|
RETURN_TYPES = ("MASK",) |
|
|
|
|
FUNCTION = "load_image" |
|
|
|
|
def load_image(self, image, channel): |
|
|
|
|
image_path = os.path.join(self.input_dir, image) |
|
|
|
|
input_dir = folder_paths.get_input_directory() |
|
|
|
|
image_path = os.path.join(input_dir, image) |
|
|
|
|
i = Image.open(image_path) |
|
|
|
|
mask = None |
|
|
|
|
c = channel[0].upper() |
|
|
|
@ -930,7 +928,8 @@ class LoadImageMask:
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
def IS_CHANGED(s, image, channel): |
|
|
|
|
image_path = os.path.join(s.input_dir, image) |
|
|
|
|
input_dir = folder_paths.get_input_directory() |
|
|
|
|
image_path = os.path.join(input_dir, image) |
|
|
|
|
m = hashlib.sha256() |
|
|
|
|
with open(image_path, 'rb') as f: |
|
|
|
|
m.update(f.read()) |
|
|
|
|