fix upscale loop erroneously applied multiple times
This commit is contained in:
parent
822210bae5
commit
30b1bcc64e
1 changed files with 10 additions and 2 deletions
|
@ -57,10 +57,18 @@ class Upscaler:
|
||||||
self.scale = scale
|
self.scale = scale
|
||||||
dest_w = img.width * scale
|
dest_w = img.width * scale
|
||||||
dest_h = img.height * scale
|
dest_h = img.height * scale
|
||||||
|
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
if img.width > dest_w and img.height > dest_h:
|
shape = (img.width, img.height)
|
||||||
break
|
|
||||||
img = self.do_upscale(img, selected_model)
|
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:
|
if img.width != dest_w or img.height != dest_h:
|
||||||
img = img.resize((int(dest_w), int(dest_h)), resample=LANCZOS)
|
img = img.resize((int(dest_w), int(dest_h)), resample=LANCZOS)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue