From 5c2ae6fd66415f27382c5ac7147a9c5db44eff2c Mon Sep 17 00:00:00 2001 From: AbdulRehman Date: Mon, 6 Apr 2026 16:49:49 +0500 Subject: [PATCH] fix: support batch broadcasting in JoinImageWithAlpha node (#12580) --- comfy_extras/nodes_compositing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy_extras/nodes_compositing.py b/comfy_extras/nodes_compositing.py index 3bc9fccb3e85..5da25a4ac60b 100644 --- a/comfy_extras/nodes_compositing.py +++ b/comfy_extras/nodes_compositing.py @@ -202,12 +202,12 @@ def define_schema(cls): @classmethod 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 = [] alpha = 1.0 - resize_mask(alpha, image.shape[1:]) 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))