mirror of
https://github.com/thomasasfk/sd-webui-aspect-ratio-helper.git
synced 2026-01-26 19:19:58 +00:00
f41fe98ced3de3f4db859ea14c591ec5e0da92cf
Aspect Ratio Helper 
Simple extension to easily maintain aspect ratio while changing dimensions.
Install via the extensions tab on the AUTOMATIC1111 webui.
Features
- Scale to maximum dimension
- Upon clicking, the width and height will scale according to the configured maximum value
- Aspect ratio will be retained, the smaller or equivalent dimension will be scaled to match
- Scale to aspect ratio
- Upon clicking, the current dimensions will be scaled to the given aspect ratio, using the highest width or height
- i.e
4:3 of 256x512 = 512x3849:16 of 512x256 = 288x5121:1 of 256x300 = 300x300
- i.e
- You can optionally toggle this to use the "Maximum dimension" slider value
- i.e
4:3 of 512 = 512x3849:16 of 512 = 288x5121:1 of 300 = 300x300
- i.e
- Upon clicking, the current dimensions will be scaled to the given aspect ratio, using the highest width or height
- Scale by percentage
- Upon clicking, the current dimensions will be multiplied by the given percentage, with aspect ratio maintained
- i.e
-25% of 512x256 = 384x192+50% of 512x512 = 768x768- You can also change the display of these if you find it more intuitive
- i.e
75% of 512x256 = 384x192150% of 512x512 = 768x768 - i.e
x0.75 of 512x256 = 384x192x1.5 of 512x512 = 768x768
Settings
- Expand by default (
False)- Determines whether the 'Aspect Ratio Helper' accordion expands by default
- UI Component order (
MaxDimensionScaler, PredefinedAspectRatioButtons, PredefinedPercentageButtons)- Determines the order in which the UI components will render
- Show maximum dimension button (
True) - Maximum dimension default (
1024) - Show pre-defined aspect ratio buttons (
True) - Use "Maximum dimension" for aspect ratio buttons (
False) - Pre-defined aspect ratio buttons (
1:1, 4:3, 16:9, 9:16, 21:9)- i.e
1:1, 4:3, 16:9, 9:16, 21:92:3, 1:5, 3:5
- i.e
- Show pre-defined percentage buttons (
True) - Pre-defined percentage buttons (
25, 50, 75, 125, 150, 175, 200)- i.e
25, 50, 75, 125, 150, 175, 20050, 125, 300
- i.e
- Pre-defined percentage display format (
Incremental/decremental percentage (-50%, +50%))Incremental/decremental percentage (-50%, +50%)Raw percentage (50%, 150%)Multiplication (x0.5, x1.5)
Contributing
- Open an issue for suggestions
- Raise a pull request
Dependencies
Developed using existing AUTOMATIC1111 webui dependencies.
However - for running unit tests, we use pytest.
pip install pytest
Testing
From the root of the repository.
pytest
Description
Simple extension to easily maintain aspect ratio while changing dimensions. Install via the extensions tab on the AUTOMATIC1111 webui.
Readme
476 KiB
Languages
Python
67.6%
JavaScript
30.8%
CSS
1.6%

