Skip to content

Commit

Permalink
Merge pull request AUTOMATIC1111#15594 from AUTOMATIC1111/fix-get_cro…
Browse files Browse the repository at this point in the history
…p_region_v2

fix get_crop_region_v2
  • Loading branch information
AUTOMATIC1111 committed Apr 22, 2024
2 parents e2b177c + 821adc3 commit 8f64dad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def get_crop_region_v2(mask, pad=0):
mask = mask if isinstance(mask, Image.Image) else Image.fromarray(mask)
if box := mask.getbbox():
x1, y1, x2, y2 = box
return max(x1 - pad, 0), max(y1 - pad, 0), min(x2 + pad, mask.size[0]), min(y2 + pad, mask.size[1]) if pad else box
return (max(x1 - pad, 0), max(y1 - pad, 0), min(x2 + pad, mask.size[0]), min(y2 + pad, mask.size[1])) if pad else box


def get_crop_region(mask, pad=0):
Expand Down

0 comments on commit 8f64dad

Please sign in to comment.