diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2022-11-05 13:20:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-05 13:20:40 +0000 |
commit | 37ba0070ec14d35addf00f6ae88b7b6c7a1c8ae6 (patch) | |
tree | baaf04c26d2bd325d322084ae7fc4ba367836753 /modules/upscaler.py | |
parent | b8435e632f7ba0da12a2c8e9c788dda519279d24 (diff) | |
parent | c9b2eef6a3b986fafdd1c13a3fb14969cbe909ca (diff) | |
download | stable-diffusion-webui-gfx803-37ba0070ec14d35addf00f6ae88b7b6c7a1c8ae6.tar.gz stable-diffusion-webui-gfx803-37ba0070ec14d35addf00f6ae88b7b6c7a1c8ae6.tar.bz2 stable-diffusion-webui-gfx803-37ba0070ec14d35addf00f6ae88b7b6c7a1c8ae6.zip |
Merge branch 'master' into feat/allow-origins
Diffstat (limited to 'modules/upscaler.py')
-rw-r--r-- | modules/upscaler.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/upscaler.py b/modules/upscaler.py index 83fde7ca..c4e6e6bd 100644 --- a/modules/upscaler.py +++ b/modules/upscaler.py @@ -57,10 +57,18 @@ class Upscaler: self.scale = scale dest_w = img.width * scale dest_h = img.height * scale + for i in range(3): - if img.width > dest_w and img.height > dest_h: - break + shape = (img.width, img.height) + img = self.do_upscale(img, selected_model) + + if shape == (img.width, img.height): + break + + if img.width >= dest_w and img.height >= dest_h: + break + if img.width != dest_w or img.height != dest_h: img = img.resize((int(dest_w), int(dest_h)), resample=LANCZOS) |