Skip to content

Commit e6a512a

Browse files
committed
(minor) Tweak order of mask operations.
1 parent c3a6a6f commit e6a512a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

invokeai/app/invocations/mask.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ def invoke(self, context: InvocationContext) -> ImageOutput:
138138
# Ensure that the mask is binary.
139139
if mask.dtype != torch.bool:
140140
mask = mask > 0.5
141-
mask_np = mask.float().cpu().detach().numpy() * 255
142-
mask_np = mask_np.astype(np.uint8)
141+
mask_np = (mask.float() * 255).byte().cpu().numpy()
143142

144143
mask_pil = Image.fromarray(mask_np, mode="L")
145144
image_dto = context.images.save(image=mask_pil)

0 commit comments

Comments
 (0)