From 17b24e45e8839d889af35ee0b2fb0825306ddafe Mon Sep 17 00:00:00 2001 From: Francesco Manzali Date: Tue, 31 Jan 2023 18:58:36 +0100 Subject: Fix prompt matrix #rows/#cols when using hires - images.draw_prompt_matrix() should be called with the final width/height of the generated images, after upscaling. Otherwise, the number of rows/cols computed in images.draw_grid_annotations will increase by the upscaling factor. - Round the number of cols/rows in images.draw_grid_annotations, since the final images width may be a bit less than the required hr_upscale_to_x/y --- scripts/prompt_matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/prompt_matrix.py') diff --git a/scripts/prompt_matrix.py b/scripts/prompt_matrix.py index dd95e588..f6575b6b 100644 --- a/scripts/prompt_matrix.py +++ b/scripts/prompt_matrix.py @@ -79,7 +79,7 @@ class Script(scripts.Script): processed = process_images(p) grid = images.image_grid(processed.images, p.batch_size, rows=1 << ((len(prompt_matrix_parts) - 1) // 2)) - grid = images.draw_prompt_matrix(grid, p.width, p.height, prompt_matrix_parts) + grid = images.draw_prompt_matrix(grid, max(p.width, p.hr_upscale_to_x), max(p.height, p.hr_upscale_to_y), prompt_matrix_parts) processed.images.insert(0, grid) processed.index_of_first_image = 1 processed.infotexts.insert(0, processed.infotexts[0]) -- cgit v1.2.1 From 5afd9e82c3829348c58803cd85b02c87308fffae Mon Sep 17 00:00:00 2001 From: Francesco Manzali Date: Wed, 1 Feb 2023 21:16:52 +0100 Subject: Use the real images size, not the process - Use the width/height of the first image in processed.images - No more need for rounding in prompt_matrix --- scripts/prompt_matrix.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/prompt_matrix.py') diff --git a/scripts/prompt_matrix.py b/scripts/prompt_matrix.py index f6575b6b..50c7f3cb 100644 --- a/scripts/prompt_matrix.py +++ b/scripts/prompt_matrix.py @@ -78,8 +78,8 @@ class Script(scripts.Script): p.prompt_for_display = original_prompt processed = process_images(p) - grid = images.image_grid(processed.images, p.batch_size, rows=1 << ((len(prompt_matrix_parts) - 1) // 2)) - grid = images.draw_prompt_matrix(grid, max(p.width, p.hr_upscale_to_x), max(p.height, p.hr_upscale_to_y), prompt_matrix_parts) + grid = images.image_grid(processed.images, p.batch_size, rows=1 << ((len(prompt_matrix_parts) - 1) // 2)) + grid = images.draw_prompt_matrix(grid, processed.images[0].width, processed.images[1].height, prompt_matrix_parts) processed.images.insert(0, grid) processed.index_of_first_image = 1 processed.infotexts.insert(0, processed.infotexts[0]) -- cgit v1.2.1 From 48d171bbb373e3db9aef0776fe681b63056272b7 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sun, 19 Feb 2023 12:25:05 +0300 Subject: fix incorrectly named args for gr.Slider in prompt matrix and xyz grid --- scripts/prompt_matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/prompt_matrix.py') diff --git a/scripts/prompt_matrix.py b/scripts/prompt_matrix.py index 3ee3cbe4..6340a7d9 100644 --- a/scripts/prompt_matrix.py +++ b/scripts/prompt_matrix.py @@ -54,7 +54,7 @@ class Script(scripts.Script): prompt_type = gr.Radio(["positive", "negative"], label="Select prompt", elem_id=self.elem_id("prompt_type"), value="positive") variations_delimiter = gr.Radio(["comma", "space"], label="Select joining char", elem_id=self.elem_id("variations_delimiter"), value="comma") with gr.Column(): - margin_size = gr.Slider(label="Grid margins (px)", min=0, max=500, value=0, step=2, elem_id=self.elem_id("margin_size")) + margin_size = gr.Slider(label="Grid margins (px)", minimum=0, maximum=500, value=0, step=2, elem_id=self.elem_id("margin_size")) return [put_at_start, different_seeds, prompt_type, variations_delimiter, margin_size] -- cgit v1.2.1