From fb458878d8c5d9b9a657ee5a60f4be1bb956506e Mon Sep 17 00:00:00 2001 From: Sammy Franklin Date: Wed, 27 Sep 2023 22:02:24 -0700 Subject: [PATCH] matching mask dimensions of (W, H) --- comfy_extras/nodes_mask.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/comfy_extras/nodes_mask.py b/comfy_extras/nodes_mask.py index af7cb07bf..41ff747b8 100644 --- a/comfy_extras/nodes_mask.py +++ b/comfy_extras/nodes_mask.py @@ -237,24 +237,24 @@ class MaskComposite: source = source.reshape((-1, source.shape[-2], source.shape[-1])) left, top = (x, y,) - right, bottom = (min(left + source.shape[-1], destination.shape[-1]), min(top + source.shape[-2], destination.shape[-2])) + right, bottom = (min(left + source.shape[-2], destination.shape[-2]), min(top + source.shape[-1], destination.shape[-1])) visible_width, visible_height = (right - left, bottom - top,) source_portion = source[:visible_height, :visible_width] destination_portion = destination[top:bottom, left:right] if operation == "multiply": - output[:, top:bottom, left:right] = destination_portion * source_portion + output[:, left:right, top:bottom] = destination_portion * source_portion elif operation == "add": - output[:, top:bottom, left:right] = destination_portion + source_portion + output[:, left:right, top:bottom] = destination_portion + source_portion elif operation == "subtract": - output[:, top:bottom, left:right] = destination_portion - source_portion + output[:, left:right, top:bottom] = destination_portion - source_portion elif operation == "and": - output[:, top:bottom, left:right] = torch.bitwise_and(destination_portion.round().bool(), source_portion.round().bool()).float() + output[:, left:right, top:bottom] = torch.bitwise_and(destination_portion.round().bool(), source_portion.round().bool()).float() elif operation == "or": - output[:, top:bottom, left:right] = torch.bitwise_or(destination_portion.round().bool(), source_portion.round().bool()).float() + output[:, left:right, top:bottom] = torch.bitwise_or(destination_portion.round().bool(), source_portion.round().bool()).float() elif operation == "xor": - output[:, top:bottom, left:right] = torch.bitwise_xor(destination_portion.round().bool(), source_portion.round().bool()).float() + output[:, left:right, top:bottom] = torch.bitwise_xor(destination_portion.round().bool(), source_portion.round().bool()).float() output = torch.clamp(output, 0.0, 1.0)