diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-07-14 07:12:48 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-07-14 07:12:48 +0000 |
commit | 92a3236161099aca735c3f59f30859750d9e7452 (patch) | |
tree | ffc981e3fdd856dbc389af2e56f0d97d38ecaec1 /modules/images.py | |
parent | 9a3f35b028a8026291679c35e1df5b2aea327a1d (diff) | |
parent | 9893d09b4378d14c2a3ef370a5e02b906993ea86 (diff) | |
download | stable-diffusion-webui-gfx803-92a3236161099aca735c3f59f30859750d9e7452.tar.gz stable-diffusion-webui-gfx803-92a3236161099aca735c3f59f30859750d9e7452.tar.bz2 stable-diffusion-webui-gfx803-92a3236161099aca735c3f59f30859750d9e7452.zip |
Merge branch 'dev' into sdxl
Diffstat (limited to 'modules/images.py')
-rw-r--r-- | modules/images.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/images.py b/modules/images.py index b5412548..4bdedb7f 100644 --- a/modules/images.py +++ b/modules/images.py @@ -306,12 +306,14 @@ def resize_image(resize_mode, im, width, height, upscaler_name=None): if ratio < src_ratio:
fill_height = height // 2 - src_h // 2
- res.paste(resized.resize((width, fill_height), box=(0, 0, width, 0)), box=(0, 0))
- res.paste(resized.resize((width, fill_height), box=(0, resized.height, width, resized.height)), box=(0, fill_height + src_h))
+ if fill_height > 0:
+ res.paste(resized.resize((width, fill_height), box=(0, 0, width, 0)), box=(0, 0))
+ res.paste(resized.resize((width, fill_height), box=(0, resized.height, width, resized.height)), box=(0, fill_height + src_h))
elif ratio > src_ratio:
fill_width = width // 2 - src_w // 2
- res.paste(resized.resize((fill_width, height), box=(0, 0, 0, height)), box=(0, 0))
- res.paste(resized.resize((fill_width, height), box=(resized.width, 0, resized.width, height)), box=(fill_width + src_w, 0))
+ if fill_width > 0:
+ res.paste(resized.resize((fill_width, height), box=(0, 0, 0, height)), box=(0, 0))
+ res.paste(resized.resize((fill_width, height), box=(resized.width, 0, resized.width, height)), box=(fill_width + src_w, 0))
return res
|