CivArchive
    ← All articles
    Published October 13, 2024by zentrocdot

    AUTOMATIC1111 Extension Aspect Ratio to Width/Height

    95 views0 reactions0 comments on CivitAI0 collected
    web uiaspect ratioextensionautomatic1111tool guide

    Preface

    The aspect ratio has always been an important aspect of art over time. Since I could not find any suitable tools that did what I wanted, I tried to programme my own Extension for AUTOMATIC1111. Since that worked out successfully, I went on to programme interesting aspects around the topic of aspect ratios.

    The Extension I am presenting here in this article is the last one of its kind. There will be enhancements and improvements in due course.

    Presumption

    I made the following assumption when programming the extions. This is also based on my experience.

    An AI generated image should never be smaller than 512 pixel in width or in height. To prevent unwanted side effects, the smallest possible combination of width to height should always be used.

    What the Extension Does

    After installation and opening the Extension in the sidebar it looks like below.

    One can enter an aspect ratio like 6:5 or 5:6 in the text field. Using the Calculate button Width and Height are calculated. Using the Apply button one can use the calculated values for Width and Height in the web UI.

    I added two features, to have more control over the calculation. As everybody knows a resolution must be an integer number and not a floating point number. By the radio button Rounding rounding of the values can be enforced. By the radio button Exact Calculation an exact calculation will be performed.

    Let me explain what exact calculation means using an example. Let's say that we want to use an aspect ratio of 6:5. The regular calculation leads to a resolution of 614.4 x 512 pixel. An exact calculation leads to a resolution of 624 x 520 pixel. The first one needs to be rounded to be meaningful usable in the image generation.

    Installation

    The URL for installation is

    https://github.com/zentrocdot/sd-webui-aspect_ratio2width_height

    Enhancement

    The exact calculation is done on base on a factor of two. I have in mind to test the Extension factors of 2, 4, 8 and 16. If this makes some sense I will an a drop down menu to select the desired factor.

    To-Do

    The documentation to the Extension needs to be written.

    Final Word

    Have a nice day. Have fun. Happy testing. Be inspired!

    Reference

    [1] https://github.com/zentrocdot/sd-webui-aspect_ratio2width_height

    [2] https://github.com/AUTOMATIC1111/stable-diffusion-webui