mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-23 21:37:01 +08:00
Merge e6c72a3752957a0b0028a57e1280c1395821802b into 2381d36e6db8e8150e42ff2ede628db5b00ae26f
This commit is contained in:
commit
60da3c4e6f
16
nodes.py
16
nodes.py
@ -901,7 +901,6 @@ class EmptyLatentImage:
|
|||||||
latent = torch.zeros([batch_size, 4, height // 8, width // 8])
|
latent = torch.zeros([batch_size, 4, height // 8, width // 8])
|
||||||
return ({"samples":latent}, )
|
return ({"samples":latent}, )
|
||||||
|
|
||||||
|
|
||||||
class LatentFromBatch:
|
class LatentFromBatch:
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
@ -1341,7 +1340,7 @@ class LoadImage:
|
|||||||
|
|
||||||
CATEGORY = "image"
|
CATEGORY = "image"
|
||||||
|
|
||||||
RETURN_TYPES = ("IMAGE", "MASK")
|
RETURN_TYPES = ("IMAGE", "MASK", "IMAGE")
|
||||||
FUNCTION = "load_image"
|
FUNCTION = "load_image"
|
||||||
def load_image(self, image):
|
def load_image(self, image):
|
||||||
image_path = folder_paths.get_annotated_filepath(image)
|
image_path = folder_paths.get_annotated_filepath(image)
|
||||||
@ -1350,12 +1349,21 @@ class LoadImage:
|
|||||||
image = i.convert("RGB")
|
image = i.convert("RGB")
|
||||||
image = np.array(image).astype(np.float32) / 255.0
|
image = np.array(image).astype(np.float32) / 255.0
|
||||||
image = torch.from_numpy(image)[None,]
|
image = torch.from_numpy(image)[None,]
|
||||||
|
|
||||||
|
smooth_image = image.detach().clone()
|
||||||
if 'A' in i.getbands():
|
if 'A' in i.getbands():
|
||||||
mask = np.array(i.getchannel('A')).astype(np.float32) / 255.0
|
mask = np.array(i.getchannel('A')).astype(np.float32) / 255.0
|
||||||
mask = 1. - torch.from_numpy(mask)
|
mask = torch.from_numpy(mask)
|
||||||
|
|
||||||
|
mask1 = torch.ones_like(image)
|
||||||
|
mask1[0, :, :, 0] = mask
|
||||||
|
mask1[0, :, :, 1] = mask
|
||||||
|
mask1[0, :, :, 2] = mask
|
||||||
|
smooth_image = smooth_image * mask1
|
||||||
|
mask = 1.0 - mask
|
||||||
else:
|
else:
|
||||||
mask = torch.zeros((64,64), dtype=torch.float32, device="cpu")
|
mask = torch.zeros((64,64), dtype=torch.float32, device="cpu")
|
||||||
return (image, mask)
|
return (image, mask, smooth_image)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def IS_CHANGED(s, image):
|
def IS_CHANGED(s, image):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user