Spaces:
Running
on
Zero
Running
on
Zero
Fix for custom mask and autocrop
#5
by
Deylone
- opened
Currently custom masks are broken if autocrop is set (which is requirement for most upload pictures) because the mask isn't also cropped.
Line 156 of app.py should be replaced with the following code to fix this:
[TAB]maskpil = dict['layers'][0].convert("RGB")
[TAB]maskwidth, maskheight = maskpil.size
[TAB]if is_checked_crop:
[TAB][TAB]maskpil = maskpil.crop((left/widthmaskwidth, top/heightmaskheight, right/widthmaskwidth, bottom/heightmaskheight) )
[TAB]mask = pil_to_binary_mask(maskpil.resize((768,1024)))