mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
(minor) Tweak order of mask operations.
This commit is contained in:
parent
c3a6a6fb22
commit
e6a512aa86
@ -138,8 +138,7 @@ class MaskTensorToImageInvocation(BaseInvocation, WithMetadata, WithBoard):
|
|||||||
# Ensure that the mask is binary.
|
# Ensure that the mask is binary.
|
||||||
if mask.dtype != torch.bool:
|
if mask.dtype != torch.bool:
|
||||||
mask = mask > 0.5
|
mask = mask > 0.5
|
||||||
mask_np = mask.float().cpu().detach().numpy() * 255
|
mask_np = (mask.float() * 255).byte().cpu().numpy()
|
||||||
mask_np = mask_np.astype(np.uint8)
|
|
||||||
|
|
||||||
mask_pil = Image.fromarray(mask_np, mode="L")
|
mask_pil = Image.fromarray(mask_np, mode="L")
|
||||||
image_dto = context.images.save(image=mask_pil)
|
image_dto = context.images.save(image=mask_pil)
|
||||||
|
Loading…
Reference in New Issue
Block a user