Merge pull request #10942 from ramyma/round-upscale-result-dims

Round upscaled dimensions only when not divisible by 8
This commit is contained in:
AUTOMATIC1111 2023-06-03 14:50:46 +03:00 committed by GitHub
commit 80ae378f34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,8 +53,8 @@ class Upscaler:
def upscale(self, img: PIL.Image, scale, selected_model: str = None): def upscale(self, img: PIL.Image, scale, selected_model: str = None):
self.scale = scale self.scale = scale
dest_w = round((img.width * scale - 4) / 8) * 8 dest_w = int((img.width * scale) // 8 * 8)
dest_h = round((img.height * scale - 4) / 8) * 8 dest_h = int((img.height * scale) // 8 * 8)
for _ in range(3): for _ in range(3):
shape = (img.width, img.height) shape = (img.width, img.height)