Commit 5afd9e82 authored by Francesco Manzali's avatar Francesco Manzali
Browse files

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
parent 17b24e45
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -171,8 +171,8 @@ def draw_grid_annotations(im, width, height, hor_texts, ver_texts):


    pad_left = 0 if sum([sum([len(line.text) for line in lines]) for lines in ver_texts]) == 0 else width * 3 // 4
    pad_left = 0 if sum([sum([len(line.text) for line in lines]) for lines in ver_texts]) == 0 else width * 3 // 4


    cols = round(im.width / width)
    cols = im.width // width
    rows = round(im.height / height)
    rows = im.height // height


    assert cols == len(hor_texts), f'bad number of horizontal texts: {len(hor_texts)}; must be {cols}'
    assert cols == len(hor_texts), f'bad number of horizontal texts: {len(hor_texts)}; must be {cols}'
    assert rows == len(ver_texts), f'bad number of vertical texts: {len(ver_texts)}; must be {rows}'
    assert rows == len(ver_texts), f'bad number of vertical texts: {len(ver_texts)}; must be {rows}'
+2 −2
Original line number Original line Diff line number Diff line
@@ -79,7 +79,7 @@ class Script(scripts.Script):
        processed = process_images(p)
        processed = process_images(p)


        grid = images.image_grid(processed.images, p.batch_size, rows=1 << ((len(prompt_matrix_parts) - 1) // 2)) 
        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.draw_prompt_matrix(grid, processed.images[0].width, processed.images[1].height, prompt_matrix_parts)
        processed.images.insert(0, grid)
        processed.images.insert(0, grid)
        processed.index_of_first_image = 1
        processed.index_of_first_image = 1
        processed.infotexts.insert(0, processed.infotexts[0])
        processed.infotexts.insert(0, processed.infotexts[0])