Fixes silent crash when init image too large

To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server.

If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit.

Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data.
This commit is contained in:
psychedelicious 2022-11-01 16:50:24 +11:00 committed by Lincoln Stein
parent 82dcbac28f
commit 21483f5d07
2 changed files with 2 additions and 6 deletions

View File

@ -573,11 +573,7 @@ class InvokeAIWebServer:
)
)
)
# crop the mask image
cropped_mask_image = copy_image_from_bounding_box(
mask_image, **generation_parameters["bounding_box"]
)
generation_parameters["init_mask"] = cropped_mask_image
generation_parameters["init_mask"] = mask_image
totalSteps = self.calculate_real_steps(
steps=generation_parameters["steps"],

View File

@ -101,7 +101,7 @@ const generateMask = (
new Konva.Image({ image: image, globalCompositeOperation: 'source-out' })
);
const maskDataURL = stage.toDataURL();
const maskDataURL = stage.toDataURL({ ...boundingBox });
return { maskDataURL, isMaskEmpty };
};