Merge branch 'fix-mask-nodes' of https://github.com/jn-jairo/ComfyUI

This commit is contained in:
comfyanonymous 2023-10-14 02:42:06 -04:00
commit 3fcab0c642

View File

@ -240,8 +240,8 @@ class MaskComposite:
right, bottom = (min(left + source.shape[-1], destination.shape[-1]), min(top + source.shape[-2], destination.shape[-2])) right, bottom = (min(left + source.shape[-1], destination.shape[-1]), min(top + source.shape[-2], destination.shape[-2]))
visible_width, visible_height = (right - left, bottom - top,) visible_width, visible_height = (right - left, bottom - top,)
source_portion = source[:visible_height, :visible_width] source_portion = source[:, :visible_height, :visible_width]
destination_portion = destination[top:bottom, left:right] destination_portion = destination[:, top:bottom, left:right]
if operation == "multiply": if operation == "multiply":
output[:, top:bottom, left:right] = destination_portion * source_portion output[:, top:bottom, left:right] = destination_portion * source_portion
@ -282,10 +282,10 @@ class FeatherMask:
def feather(self, mask, left, top, right, bottom): def feather(self, mask, left, top, right, bottom):
output = mask.reshape((-1, mask.shape[-2], mask.shape[-1])).clone() output = mask.reshape((-1, mask.shape[-2], mask.shape[-1])).clone()
left = min(left, output.shape[1]) left = min(left, output.shape[-1])
right = min(right, output.shape[1]) right = min(right, output.shape[-1])
top = min(top, output.shape[0]) top = min(top, output.shape[-2])
bottom = min(bottom, output.shape[0]) bottom = min(bottom, output.shape[-2])
for x in range(left): for x in range(left):
feather_rate = (x + 1.0) / left feather_rate = (x + 1.0) / left