diff options
author | Muhammad Rizqi Nur <rizqinur2010@gmail.com> | 2022-11-07 15:43:38 +0000 |
---|---|---|
committer | Muhammad Rizqi Nur <rizqinur2010@gmail.com> | 2022-11-07 15:43:38 +0000 |
commit | cabd4e3b3bf91e0cb5071398a8efddef495f6311 (patch) | |
tree | 55daa888a7e03e2e204daf6729835b94277350a2 /modules/upscaler.py | |
parent | bb832d7725187f8a8ab44faa6ee1b38cb5f600aa (diff) | |
parent | 804d9fb83d0c63ca3acd36378707ce47b8f12599 (diff) | |
download | stable-diffusion-webui-gfx803-cabd4e3b3bf91e0cb5071398a8efddef495f6311.tar.gz stable-diffusion-webui-gfx803-cabd4e3b3bf91e0cb5071398a8efddef495f6311.tar.bz2 stable-diffusion-webui-gfx803-cabd4e3b3bf91e0cb5071398a8efddef495f6311.zip |
Merge branch 'master' into gradient-clipping
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) |