aboutsummaryrefslogtreecommitdiffstats
path: root/modules/upscaler.py
diff options
context:
space:
mode:
authorevshiron <evshiron@gmail.com>2022-11-05 14:12:20 +0000
committerevshiron <evshiron@gmail.com>2022-11-05 14:12:20 +0000
commitb6cfaaa20b81d16a978524c952412cfc4d89a414 (patch)
treee0aa306e34e796c79f657d2a73f558de46f80764 /modules/upscaler.py
parent73e1cd6f53f3566973805666a4049450cdb8da1b (diff)
parent62e3d71aa778928d63cab81d9d8cde33e55bebb3 (diff)
downloadstable-diffusion-webui-gfx803-b6cfaaa20b81d16a978524c952412cfc4d89a414.tar.gz
stable-diffusion-webui-gfx803-b6cfaaa20b81d16a978524c952412cfc4d89a414.tar.bz2
stable-diffusion-webui-gfx803-b6cfaaa20b81d16a978524c952412cfc4d89a414.zip
Merge branch 'master' into fix/encode-pnginfo
Diffstat (limited to 'modules/upscaler.py')
-rw-r--r--modules/upscaler.py12
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)