mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-04-13 11:38:36 +00:00
Merge e8e5496b4d
into 22ad513c72
This commit is contained in:
commit
3a10f04b7a
9
nodes.py
9
nodes.py
@ -1655,14 +1655,17 @@ class LoadImage:
|
|||||||
input_dir = folder_paths.get_input_directory()
|
input_dir = folder_paths.get_input_directory()
|
||||||
files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))]
|
files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))]
|
||||||
return {"required":
|
return {"required":
|
||||||
{"image": (sorted(files), {"image_upload": True})},
|
{
|
||||||
|
"image": (sorted(files), {"image_upload": True}),
|
||||||
|
"out_alpha": ("BOOLEAN", {"default": False}),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CATEGORY = "image"
|
CATEGORY = "image"
|
||||||
|
|
||||||
RETURN_TYPES = ("IMAGE", "MASK")
|
RETURN_TYPES = ("IMAGE", "MASK")
|
||||||
FUNCTION = "load_image"
|
FUNCTION = "load_image"
|
||||||
def load_image(self, image):
|
def load_image(self, image, out_alpha):
|
||||||
image_path = folder_paths.get_annotated_filepath(image)
|
image_path = folder_paths.get_annotated_filepath(image)
|
||||||
|
|
||||||
img = node_helpers.pillow(Image.open, image_path)
|
img = node_helpers.pillow(Image.open, image_path)
|
||||||
@ -1678,7 +1681,7 @@ class LoadImage:
|
|||||||
|
|
||||||
if i.mode == 'I':
|
if i.mode == 'I':
|
||||||
i = i.point(lambda i: i * (1 / 255))
|
i = i.point(lambda i: i * (1 / 255))
|
||||||
image = i.convert("RGB")
|
image = i.convert("RGBA" if out_alpha else "RGB")
|
||||||
|
|
||||||
if len(output_images) == 0:
|
if len(output_images) == 0:
|
||||||
w = image.size[0]
|
w = image.size[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user