diff options
author | Bruno Seoane <breyxxi@gmail.com> | 2022-11-05 18:56:41 +0000 |
---|---|---|
committer | Bruno Seoane <breyxxi@gmail.com> | 2022-11-05 18:56:41 +0000 |
commit | 59ec427dff84365588a51eb6454f3be47b74fea1 (patch) | |
tree | b0e4a5eef633e4ec9f3f663f45752058d2bba716 /modules/upscaler.py | |
parent | fd66f669ea25bad1409aec87ef14b8417009bddc (diff) | |
parent | b08698a09a257365238e43cc9023ce7cf9af73c4 (diff) | |
download | stable-diffusion-webui-gfx803-59ec427dff84365588a51eb6454f3be47b74fea1.tar.gz stable-diffusion-webui-gfx803-59ec427dff84365588a51eb6454f3be47b74fea1.tar.bz2 stable-diffusion-webui-gfx803-59ec427dff84365588a51eb6454f3be47b74fea1.zip |
Merge remote-tracking branch 'upstream/master'
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) |