Repository navigation
Expand file tree
/
Copy pathnode.py
More file actions
57 lines (48 loc) · 1.48 KB
/
Copy pathnode.py
File metadata and controls
57 lines (48 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from nodes import PreviewImage
class SimpleCompare(PreviewImage):
"""Shows two images in one preview; click it to switch between them."""
CATEGORY = "image"
FUNCTION = "compare_images"
RETURN_TYPES = ("IMAGE",)
RETURN_NAMES = ("image",)
OUTPUT_NODE = True
@classmethod
def INPUT_TYPES(cls):
return {
"required": {},
"optional": {
"image_a": ("IMAGE",),
"image_b": ("IMAGE",),
},
"hidden": {
"prompt": "PROMPT",
"extra_pnginfo": "EXTRA_PNGINFO",
"id": "UNIQUE_ID",
},
}
@classmethod
def IS_CHANGED(cls, **kwargs):
return float("NaN")
def compare_images(
self,
image_a=None,
image_b=None,
filename_prefix="comparer.",
prompt=None,
extra_pnginfo=None,
id=None,
):
ui_a = []
ui_b = []
if image_a is not None and len(image_a) > 0:
ui_a = self.save_images(image_a, filename_prefix, prompt, extra_pnginfo)["ui"]["images"]
if image_b is not None and len(image_b) > 0:
ui_b = self.save_images(image_b, filename_prefix, prompt, extra_pnginfo)["ui"]["images"]
output_image = image_a if image_a is not None else image_b
return {
"ui": {
"a_images": ui_a,
"b_images": ui_b,
},
"result": (output_image,),
}