Merge 9fedd24fc49801aa772742c91a8ee2553db20485 into 016b219dcca2431bb46dccc04bc85c764b76409a

This commit is contained in:
Saquib Alam 2025-02-05 00:00:08 +05:30 committed by GitHub
commit 64bc91467c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1199,7 +1199,6 @@ class EmptyLatentImage:
latent = torch.zeros([batch_size, 4, height // 8, width // 8], device=self.device) latent = torch.zeros([batch_size, 4, height // 8, width // 8], device=self.device)
return ({"samples":latent}, ) return ({"samples":latent}, )
class LatentFromBatch: class LatentFromBatch:
@classmethod @classmethod
def INPUT_TYPES(s): def INPUT_TYPES(s):
@ -1792,6 +1791,28 @@ class ImageScale:
s = s.movedim(1,-1) s = s.movedim(1,-1)
return (s,) return (s,)
class ImageAlphaComposite:
@classmethod
def INPUT_TYPES(s):
return {"required": { "image1": ("IMAGE",),
"mask": ("MASK",),
"image2": ("IMAGE",)
}
}
CATEGORY = "image"
RETURN_TYPES = ("IMAGE",)
FUNCTION = "alpha_composite"
def alpha_composite(self, image1, mask, image2):
mask1 = torch.ones_like(image1)
mask1[0, :, :, 0] = mask
mask1[0, :, :, 1] = mask
mask1[0, :, :, 2] = mask
image = image1 * (torch.ones_like(mask1) - mask1) + image2 * mask1
return (image,)
class ImageScaleBy: class ImageScaleBy:
upscale_methods = ["nearest-exact", "bilinear", "area", "bicubic", "lanczos"] upscale_methods = ["nearest-exact", "bilinear", "area", "bicubic", "lanczos"]
@ -1948,6 +1969,7 @@ NODE_CLASS_MAPPINGS = {
"PreviewImage": PreviewImage, "PreviewImage": PreviewImage,
"LoadImage": LoadImage, "LoadImage": LoadImage,
"LoadImageMask": LoadImageMask, "LoadImageMask": LoadImageMask,
"ImageAlphaComposite": ImageAlphaComposite,
"ImageScale": ImageScale, "ImageScale": ImageScale,
"ImageScaleBy": ImageScaleBy, "ImageScaleBy": ImageScaleBy,
"ImageInvert": ImageInvert, "ImageInvert": ImageInvert,
@ -2048,6 +2070,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
"PreviewImage": "Preview Image", "PreviewImage": "Preview Image",
"LoadImage": "Load Image", "LoadImage": "Load Image",
"LoadImageMask": "Load Image (as Mask)", "LoadImageMask": "Load Image (as Mask)",
"ImageAlphaComposite": "Image overlay using mask",
"ImageScale": "Upscale Image", "ImageScale": "Upscale Image",
"ImageScaleBy": "Upscale Image By", "ImageScaleBy": "Upscale Image By",
"ImageUpscaleWithModel": "Upscale Image (using Model)", "ImageUpscaleWithModel": "Upscale Image (using Model)",