sd-webui-aspect_ratios-dd is an Extension for the AUTOMATIC1111 web UI, which is adding a new functionality for the selection of predefined or user defined aspect ratios to the AUTOMATIC1111 web UI. The dd in the name of the Extension stands for dropdown, which is a hint that I am using a dropdown menu.
After writing my first Extension the realisation of this Extension was a little bit more complicated. I had a steep learning curve while programming using Gradio. At the end of the day everything works as expected.
This will be the last version I have programmed for the time being. It fulfils its purpose and can be adapted to personal requirements. Maintenance and bug fixing are not affected by the last statement.
The aspect ratio plays a crucial role when dealing with images. This statement is correct in relation to the paintings of the middle ages, pictures by photographers and in AI image creation as well.
While using AUTOMATIC1111i> I missed a tool selecting the most common aspect ratios. The tools I found did not fulfil my personal needs. This Extension is the attempt to provide a quick access to a list of suitable aspect ratios.
The tool should be as simple as possible and at the same time provide all the necessary information.
After installation, you will find a panel in the AUTOMATIC1111 web UI that looks like the following image when opened.
To keep the handling of the Extension simple I decided, that I focus on aspect ratios of the orientation landscape. Orientation portrait can be accessed by a change of the orientation. In a seperate field it is noted if it was possible to perform the calculation of width and height exact or if one value must be rounded.
The tool should be as simple as possible and at the same time provide all the necessary information. A drop-down menu allows you to select a predefined aspect ratio from a large number of aspect ratios. Using the button Apply
, the Width and Height are calculated from the given aspect ratio and taken over in the main UI. A Reset
button is resetting the Aspect Ratio back to 1:1 and Width and Height back to 512 and 512. The orientation can be switched by the button Change Orientation
. An additional information is available if the calculation of the new resolution is exact or if one value is a rounded number. The resolution can be checked in the terminal window. Th used aspect ratio data file is noted ist the last line.
Go to tab Extensions. Then go to tab Install from URL. Put in the ínstallation link in the text field URL for extension's git repository. Finally press button Install. Successful installation is displayed in the footer.
The installation link, which can be used in AUTOMATIC1111 is as follows:
https://github.com/zentrocdot/sd-webui-aspect_ratios-dd
Depending on the orientation Width or Height is set to 512 pixel. The aspect ratio is used as quotient for the calculation. The result is given in unit of measurement as pixel.
- Landscape
Height = 512 pixel Width = Height * Aspect Ratio (as quotient) in pixel
- Portrait
Width = 512 pixel Height = Width * Aspect Ratio (as quotient) in pixel
The first value is all the time set to 512. The second and calculated value is an integer or an floating point number. Both values are printed into the terminal window and can be checked there.
The given Aspect Ratios are basically sorted into two blocks. First come the Aspect Ratios with integer numbers and then the Aspect Ratios with floating point numbers.
- 1:1
- 1.5:1
- 2:1
- 3:1
- 3:2
- 4:1
- 4:3
- 5:1
- 5:3
- 5:4
- 6:1
- 6:5
- 7:1
- 7:4
- 7:5
- 7:5.5
- 8:3
- 8:5
- 9:7
- 10:1
- 10:7
- 11:5
- 11.85:3
- 12:1
- 12:5
- 12:9
- 12:10
- 13:6
- 13:18
- 13:19
- 14:9
- 14:11
- 15:8
- 15:9
- 15:10
- 16:9
- 16:10
- 17:9
- 18:5
- 18:9
- 18.5:9
- 18:10
- 19:9
- 19.5:9
- 20:9
- 21:9
- 21.5:9
- 22:9
- 22:17
- 24:9
- 25:16
- 28:13
- 32:9
- 32:25
- 35:26
- 36:10
- 37:18
- 37:20
- 40:21
- 43:18
- 45:35
- 47:20
- 51:20
- 55:23
- 64:27
- 69:25
- 70:27
- 79:20
- 128:75
- 192:145
- 239:100
- 256:135
- 300:157
- 540:283
- 1.19:1
- 1.20:1
- 1.25:1
- 1.27:1
- 1.30:1
- 1.33:1
- 1.37:1
- 1.375:1
- 1.38:1
- 1.40:1
- 1.41:1
- 1.4142:1
- 1.43:1
- 1.54:1
- 1.55:1
- 1.59:1
- 1.60:1
- 1.618:1
- 1.66:1
- 1.75:1
- 1.77:1
- 1.78:1
- 1.85:1
- 1.875:1
- 1.896:1
- 1.90:1
- 1.91:1
- 2.125:1
- 2.16:1
- 2.165:1
- 2.20:1
- 2.208:1
- 2.21:1
- 2.35:1
- 2.37:1
- 2.38:1
- 2.39:1
- 2.40:1
- 2.44:1
- 2.55:1
- 2.59:1
- 2.66:1
- 2.75:1
- 2.76:1
- 3.2:1
- 3.55:1
- 3.58:1
- 3.60:1
- 3.95:1
Aspect ratios are a recurring theme for a photographer. Whenever I come across an aspect ratio that I do not know yet, I make a note of it.
Since it makes no sense to cite all of the sources, I will refrain from doing so. Most of the listed aspect ratios can be verified via a simple internet search.
It is intended that the user can set aspect ratiosi> of his own choice. This can be explained looking at the tree structure of the Extension.
├── stable-diffusion-webui
└── extensions
└── sd-webui-aspect_ratios-dd
├── json
├── images
├── scripts
├── extension_data
│ └── aspect_ratio.data
└── user_data
└── aspect_ratio.data
If the file aspect_ratio.data
in the user_data directory exists, this file is used as the source for the drop-down menu data. Otherwise the file aspect_ratio.data
in the extension_data directory is used.
If there are aspect ratios in the Extension that I do not yet consider, but which were or are common, please let me know about them, that I can take them into account and that I can add them to the predefined list.
Improvement of this documentation.
No problems known yet.
The Extension was devolped and tested on a machine with a Debian based Linux distribution istalled using the web UI AUTOMATIC111 with following specification:
- API: v1.10.0
- Python: 3.10.14
- torch: 2.1.2+cu121
- xformers: 0.0.23.post1
- gradio: 3.41.2
AUTOMATIC1111 uses Gradio to programme the web interface. The Gradio version used is extremely buggy and outdated. Currently local version 5.0.1 is installed, AUTOMATIC1111 uses 3.41.2. In AUTOMATIC1111 forum posts it can be read that the outdated version is given priority over an adaptation. This does not really motivate users to programme extensions. It can not be that finding workarounds for bugs is the way to spend time in programming.
I am not in any way involved in the development of AUTOMATIC1111 itself. For me it is a tool like others no more no less. This Extension is an independend personal project, which is using the given possibilities of AUTOMATIC1111.
[1] https://github.com/AUTOMATIC1111/stable-diffusion-webui
[2] https://github.com/AUTOMATIC1111/stable-diffusion-webui-extensions
[3] https://www.gradio.app/docs/gradio/interface
There are various ways to support my work. One option is to purchase some of my extraordinary NFTs 😃. Some of my great collections can be found here:
- https://opensea.io/collection/fantastic-mushroom-collection
- https://opensea.io/collection/cats-with-hats-collection-1
- https://opensea.io/collection/devil-woman-collection
- https://opensea.io/collection/cup-of-ice-no-1
I loved the time when you could get also a hamburger 🍔 for one Euro!
If you like what I present here, or if it helps you, or if it is useful, you are welcome to donate a small contribution or a cup of coffee. Or as you might say: Every TRON counts! Many thanks in advance! 😃
TQamF8Q3z63sVFWiXgn2pzpWyhkQJhRtW7 (TRON) DMh7EXf7XbibFFsqaAetdQQ77Zb5TVCXiX (DOGE) 12JsKesep3yuDpmrcXCxXu7EQJkRaAvsc5 (BITCOIN) 0x31042e2F3AE241093e0387b41C6910B11d94f7ec (Ethereum)