From e6a512aa867d88558df1dde1162c9f1fe60a49c2 Mon Sep 17 00:00:00 2001 From: Ryan Dick Date: Thu, 1 Aug 2024 10:12:24 -0400 Subject: [PATCH] (minor) Tweak order of mask operations. --- invokeai/app/invocations/mask.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/invokeai/app/invocations/mask.py b/invokeai/app/invocations/mask.py index 2ebefeacff..64d1b48e38 100644 --- a/invokeai/app/invocations/mask.py +++ b/invokeai/app/invocations/mask.py @@ -138,8 +138,7 @@ class MaskTensorToImageInvocation(BaseInvocation, WithMetadata, WithBoard): # Ensure that the mask is binary. if mask.dtype != torch.bool: mask = mask > 0.5 - mask_np = mask.float().cpu().detach().numpy() * 255 - mask_np = mask_np.astype(np.uint8) + mask_np = (mask.float() * 255).byte().cpu().numpy() mask_pil = Image.fromarray(mask_np, mode="L") image_dto = context.images.save(image=mask_pil)