1
0
Fork 0

fix(api): correctly handle completely black mask images

This commit is contained in:
Sean Sube 2023-11-25 15:25:47 -06:00
parent d78e843af4
commit 1818a36c11
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 6 additions and 2 deletions

View File

@ -297,8 +297,12 @@ def run_inpaint_pipeline(
logger.debug("border zero: %s", border.isZero()) logger.debug("border zero: %s", border.isZero())
full_res_inpaint = full_res_inpaint and border.isZero() full_res_inpaint = full_res_inpaint and border.isZero()
if full_res_inpaint: if full_res_inpaint:
mask_left, mask_top, mask_right, mask_bottom = mask.getbbox() bbox = mask.getbbox()
logger.debug("mask bbox: %s", mask.getbbox()) if bbox is None:
bbox = (0, 0, source.width, source.height)
logger.debug("mask bounding box: %s", bbox)
mask_left, mask_top, mask_right, mask_bottom = bbox
mask_width = mask_right - mask_left mask_width = mask_right - mask_left
mask_height = mask_bottom - mask_top mask_height = mask_bottom - mask_top
# ensure we have some padding around the mask when we do the inpaint (and that the region size is even) # ensure we have some padding around the mask when we do the inpaint (and that the region size is even)