From 3539885f0ecd75876191e5df4578fac0654b70c0 Mon Sep 17 00:00:00 2001 From: ramyma Date: Sun, 28 May 2023 21:24:39 +0300 Subject: Round down scale destination dimensions to nearest multiple of 8 --- modules/upscaler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/upscaler.py') diff --git a/modules/upscaler.py b/modules/upscaler.py index 7b1046d6..3c82861d 100644 --- a/modules/upscaler.py +++ b/modules/upscaler.py @@ -53,8 +53,8 @@ class Upscaler: def upscale(self, img: PIL.Image, scale, selected_model: str = None): self.scale = scale - dest_w = int(img.width * scale) - dest_h = int(img.height * scale) + dest_w = round((img.width * scale - 4) / 8) * 8 + dest_h = round((img.height * scale - 4) / 8) * 8 for _ in range(3): shape = (img.width, img.height) -- cgit v1.2.1 From 31f57455dd606823b637042d701128ec4893c341 Mon Sep 17 00:00:00 2001 From: ramyma Date: Thu, 1 Jun 2023 21:42:10 +0300 Subject: Round upscaled dimensions only when not divisible by 8 --- modules/upscaler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/upscaler.py') diff --git a/modules/upscaler.py b/modules/upscaler.py index 3c82861d..2da1fd54 100644 --- a/modules/upscaler.py +++ b/modules/upscaler.py @@ -53,8 +53,8 @@ class Upscaler: def upscale(self, img: PIL.Image, scale, selected_model: str = None): self.scale = scale - dest_w = round((img.width * scale - 4) / 8) * 8 - dest_h = round((img.height * scale - 4) / 8) * 8 + dest_w = round((img.width * scale - 4) / 8) * 8 if img.width * scale % 8 != 0 else img.width * scale + dest_h = round((img.height * scale - 4) / 8) * 8 if img.height * scale % 8 != 0 else img.height * scale for _ in range(3): shape = (img.width, img.height) -- cgit v1.2.1 From 8c8c3617a7031f56242eecd2fe7e127267dbad98 Mon Sep 17 00:00:00 2001 From: ramyma Date: Sat, 3 Jun 2023 14:35:54 +0300 Subject: Use a more concise calculation for dest dims --- modules/upscaler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/upscaler.py') diff --git a/modules/upscaler.py b/modules/upscaler.py index 2da1fd54..49460993 100644 --- a/modules/upscaler.py +++ b/modules/upscaler.py @@ -53,8 +53,8 @@ class Upscaler: def upscale(self, img: PIL.Image, scale, selected_model: str = None): self.scale = scale - dest_w = round((img.width * scale - 4) / 8) * 8 if img.width * scale % 8 != 0 else img.width * scale - dest_h = round((img.height * scale - 4) / 8) * 8 if img.height * scale % 8 != 0 else img.height * scale + dest_w = int((img.width * scale) // 8 * 8) + dest_h = int((img.height * scale) // 8 * 8) for _ in range(3): shape = (img.width, img.height) -- cgit v1.2.1 From 68d842328858253308ad2c40a10be3d38ae3c31d Mon Sep 17 00:00:00 2001 From: Chanchana Sornsoontorn Date: Sat, 3 Jun 2023 22:28:00 +0700 Subject: Fix missing ext_filter kwarg --- modules/upscaler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/upscaler.py') diff --git a/modules/upscaler.py b/modules/upscaler.py index 49460993..e682bbaa 100644 --- a/modules/upscaler.py +++ b/modules/upscaler.py @@ -77,7 +77,7 @@ class Upscaler: pass def find_models(self, ext_filter=None) -> list: - return modelloader.load_models(model_path=self.model_path, model_url=self.model_url, command_path=self.user_path) + return modelloader.load_models(model_path=self.model_path, model_url=self.model_url, command_path=self.user_path, ext_filter=ext_filter) def update_status(self, prompt): print(f"\nextras: {prompt}", file=shared.progress_print_out) -- cgit v1.2.1