Skip to content

Commit 5c2ae6f

Browse files
fix: support batch broadcasting in JoinImageWithAlpha node (#12580)
1 parent d0f0b15 commit 5c2ae6f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

comfy_extras/nodes_compositing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,12 @@ def define_schema(cls):
202202

203203
@classmethod
204204
def execute(cls, image: torch.Tensor, alpha: torch.Tensor) -> io.NodeOutput:
205-
batch_size = min(len(image), len(alpha))
205+
batch_size = max(len(image), len(alpha))
206206
out_images = []
207207

208208
alpha = 1.0 - resize_mask(alpha, image.shape[1:])
209209
for i in range(batch_size):
210-
out_images.append(torch.cat((image[i][:,:,:3], alpha[i].unsqueeze(2)), dim=2))
210+
out_images.append(torch.cat((image[i % len(image)][:,:,:3], alpha[i % len(alpha)].unsqueeze(2)), dim=2))
211211

212212
return io.NodeOutput(torch.stack(out_images))
213213

0 commit comments

Comments
 (0)