Enhance your AUTOMATIC1111/stable-diffusion-webui experience with the Aspect Ratio Selector extension.
-
09/09/2023: We now support Automatic 1111 Version: v1.6.0 and Lobe Theme Version: 3.0.4. We've added more aspect ratios to the main code, improved code organization, and more.
-
20/02/2023
⚠️ Important Update: This update will replace your local configuration files (aspect_ratios.txt
andresolutions.txt
) with new default ones. Don't worry; these can be easily customized and preserved for future use. For detailed instructions, please refer to this link.
You can install the Aspect Ratio Selector extension using one of the following methods:
- Navigate to the
Extensions
tab. - Select
Install from URL
. - Paste the following URL:
(https://github.com/midnight-god-01/01-sd-webui-ar.git)
. - Click on
Install
.
- Open your terminal or command prompt.
- Navigate to the directory where you want to install the extension.
- Run the following command to clone the extension repository:
git clone https://github.com/midnight-god-01/01-sd-webui-ar.git
- Once the cloning process is complete, you can use the extension as described in the "Usage" section below.
Here's a sneak peek of the user interface after installing this extension:
Using the Aspect Ratio Selector extension is straightforward:
- Simply click on the aspect ratio button of your choice. The script adjusts the width while keeping the height fixed for aspect ratios greater than 1, and vice versa for aspect ratios less than 1.
- You can reset the image resolution by clicking on one of the buttons in the second row.
Customize aspect ratios in the /sd-webui-ar/aspect_ratios.txt
file, like this:
1:1, 1.0
3:2, 3/2
4:3, 4/3
16:9, 16/9
# 6:13, 6/13
# 9:16, 9/16
# ...
Lines starting with #
are treated as comments and are ignored. To use a custom value, uncomment the respective line by removing the #
. A custom aspect ratio is defined as button-label, aspect-ratio-value # comment
. You can choose any label for the button, and it's recommended to set the aspect-ratio-value
as a fraction, but integers or floats work as well.
Resolution presets can be defined in the resolutions.txt
file:
1, 512, 512 # 1:1 square
2, 768, 512 # 3:2 landscape
3, 403, 716 # 9:16 portrait
Use the format button-label, width, height, # optional comment
. Lines starting with #
are ignored.
The calculator helps you determine new width or height values based on the aspect ratio of source dimensions. Here's how it works:
- Click
Calc
to show or hide the aspect ratio calculator. - Set the source dimensions manually or from other sources.
- Swap the width and height if needed.
- Specify the desired width or height and click either
Calculate Height
orCalculate Width
to compute the missing value. - Click
Apply
to transfer the values to the txt2txt/img2img sliders.
Enjoy the enhanced functionality of your Stable Diffusion WebUI with the Aspect Ratio Selector extension!