Change a few things in #1578.
This commit is contained in:
parent
214ca7197e
commit
9212bea87c
|
@ -102,7 +102,7 @@ class PorterDuffImageComposite:
|
|||
|
||||
RETURN_TYPES = ("IMAGE", "MASK")
|
||||
FUNCTION = "composite"
|
||||
CATEGORY = "compositing"
|
||||
CATEGORY = "mask/compositing"
|
||||
|
||||
def composite(self, source: torch.Tensor, source_alpha: torch.Tensor, destination: torch.Tensor, destination_alpha: torch.Tensor, mode):
|
||||
batch_size = min(len(source), len(source_alpha), len(destination), len(destination_alpha))
|
||||
|
@ -149,7 +149,7 @@ class SplitImageWithAlpha:
|
|||
}
|
||||
}
|
||||
|
||||
CATEGORY = "compositing"
|
||||
CATEGORY = "mask/compositing"
|
||||
RETURN_TYPES = ("IMAGE", "MASK")
|
||||
FUNCTION = "split_image_with_alpha"
|
||||
|
||||
|
@ -170,7 +170,7 @@ class JoinImageWithAlpha:
|
|||
}
|
||||
}
|
||||
|
||||
CATEGORY = "compositing"
|
||||
CATEGORY = "mask/compositing"
|
||||
RETURN_TYPES = ("IMAGE",)
|
||||
FUNCTION = "join_image_with_alpha"
|
||||
|
||||
|
|
27
nodes.py
27
nodes.py
|
@ -1372,31 +1372,6 @@ class LoadImage:
|
|||
|
||||
return True
|
||||
|
||||
class LoadImageWithAlpha(LoadImage):
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
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))]
|
||||
return {"required":
|
||||
{"image": (sorted(files), {"image_upload": True})},
|
||||
}
|
||||
|
||||
CATEGORY = "compositing"
|
||||
|
||||
RETURN_TYPES = ("IMAGE", "MASK")
|
||||
|
||||
FUNCTION = "load_image"
|
||||
def load_image(self, image):
|
||||
image_path = folder_paths.get_annotated_filepath(image)
|
||||
i = Image.open(image_path)
|
||||
i = ImageOps.exif_transpose(i)
|
||||
image = i.convert("RGBA")
|
||||
alpha = np.array(image.getchannel("A")).astype(np.float32) / 255.0
|
||||
alpha = torch.from_numpy(alpha)[None,]
|
||||
image = np.array(image).astype(np.float32) / 255.0
|
||||
image = torch.from_numpy(image)[None,]
|
||||
return (image, alpha)
|
||||
|
||||
class LoadImageMask:
|
||||
_color_channels = ["alpha", "red", "green", "blue"]
|
||||
@classmethod
|
||||
|
@ -1631,7 +1606,6 @@ NODE_CLASS_MAPPINGS = {
|
|||
"SaveImage": SaveImage,
|
||||
"PreviewImage": PreviewImage,
|
||||
"LoadImage": LoadImage,
|
||||
"LoadImageWithAlpha": LoadImageWithAlpha,
|
||||
"LoadImageMask": LoadImageMask,
|
||||
"ImageScale": ImageScale,
|
||||
"ImageScaleBy": ImageScaleBy,
|
||||
|
@ -1728,7 +1702,6 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
|||
"SaveImage": "Save Image",
|
||||
"PreviewImage": "Preview Image",
|
||||
"LoadImage": "Load Image",
|
||||
"LoadImageWithAlpha": "Load Image with Alpha",
|
||||
"LoadImageMask": "Load Image (as Mask)",
|
||||
"ImageScale": "Upscale Image",
|
||||
"ImageScaleBy": "Upscale Image By",
|
||||
|
|
Loading…
Reference in New Issue