mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-02 21:32:31 +08:00
Merge bb5c337889 into 3086026401
This commit is contained in:
commit
8b987b0089
@ -202,12 +202,12 @@ class JoinImageWithAlpha(io.ComfyNode):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def execute(cls, image: torch.Tensor, alpha: torch.Tensor) -> io.NodeOutput:
|
def execute(cls, image: torch.Tensor, alpha: torch.Tensor) -> io.NodeOutput:
|
||||||
batch_size = min(len(image), len(alpha))
|
batch_size = max(len(image), len(alpha))
|
||||||
out_images = []
|
out_images = []
|
||||||
|
|
||||||
alpha = 1.0 - resize_mask(alpha, image.shape[1:])
|
alpha = 1.0 - resize_mask(alpha, image.shape[1:])
|
||||||
for i in range(batch_size):
|
for i in range(batch_size):
|
||||||
out_images.append(torch.cat((image[i][:,:,:3], alpha[i].unsqueeze(2)), dim=2))
|
out_images.append(torch.cat((image[i % len(image)][:,:,:3], alpha[i % len(alpha)].unsqueeze(2)), dim=2))
|
||||||
|
|
||||||
return io.NodeOutput(torch.stack(out_images))
|
return io.NodeOutput(torch.stack(out_images))
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user