diff --git a/.gitignore b/.gitignore index a69f7f5..7ab4acc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ **/*.swp -**/.mypy_cache \ No newline at end of file +**/.mypy_cache +*.py[cod] +aspect_ratios.txt +resolutions.txt diff --git a/scripts/sd-webui-ar.py b/scripts/sd-webui-ar.py index 2bd30af..dbd5c12 100644 --- a/scripts/sd-webui-ar.py +++ b/scripts/sd-webui-ar.py @@ -34,12 +34,12 @@ class ARButton(ToolButton): def apply(self, w, h): if self.ar > 1.0: # fix height, change width - w = self.ar * h - elif self.ar < 1.0: # fix width, change height h = w / self.ar - else: # set minimum dimension to both - min_dim = min([w, h]) - w, h = min_dim, min_dim + elif self.ar < 1.0: # fix width, change height + w = h * self.ar + else: + new_value = max([w, h]) + w, h = new_value, new_value return list(map(round, [w, h])) @@ -110,10 +110,11 @@ def parse_resolutions_file(filename): # TODO: write a generic function handling both cases def write_aspect_ratios_file(filename): aspect_ratios = [ - "1:1, 1.0 # 1:1 ratio based on minimum dimension\n", - "3:2, 3/2 # Set width based on 3:2 ratio to height\n", - "4:3, 4/3 # Set width based on 4:3 ratio to height\n", - "16:9, 16/9 # Set width based on 16:9 ratio to height", + "1:1, 1.0\n", + "3:2, 3/2\n", + "4:3, 4/3\n", + "16:9, 16/9\n", + "21:9, 21/9\n", ] with open(filename, "w", encoding="utf-8") as f: f.writelines(aspect_ratios) @@ -121,9 +122,11 @@ def write_aspect_ratios_file(filename): def write_resolutions_file(filename): resolutions = [ - "1, 512, 512 # 1:1 square\n", - "2, 768, 512 # 3:2 landscape\n", - "3, 403, 716 # 9:16 portrait", + "512, 512, 512\n", + "640, 640, 640\n", + "768, 768, 768\n", + "896, 896, 896\n", + "1024, 1024, 1024", ] with open(filename, "w", encoding="utf-8") as f: f.writelines(resolutions) diff --git a/style.css b/style.css index 396b411..0aedbff 100644 --- a/style.css +++ b/style.css @@ -1,19 +1,17 @@ -#txt2img_row_aspect_ratio button, -#img2img_row_aspect_ratio button { - min-width: 2.5em !important; - max-width: fit-content !important; - margin: 0 0 0.25em 0 !important; +#txt2img_container_aspect_ratio { + gap: 5px !important; } +#txt2img_row_aspect_ratio button, +#img2img_row_aspect_ratio button, #txt2img_row_resolutions button, #img2img_row_resolutions button { - min-width: 2.5em !important; - max-width: fit-content !important; - margin: 0 0 0.25em 0 !important; + max-width: none !important; } /* Fix size and display of show/hide calculator buttons */ button#arc_show_calculator_button { + display: none; padding: 0 .75em; background-color: #ffffff; --tw-gradient-from: #ffffff; @@ -21,4 +19,4 @@ button#arc_show_calculator_button { } button#arc_hide_calculator_button { padding: 0 .75em; -} \ No newline at end of file +}