thomasasfk / sd-webui-aspect-ratio-helper

Simple extension to easily maintain aspect ratio while changing dimensions. Install via the extensions tab on the AUTOMATIC1111 webui.
https://github.com/thomasasfk/sd-webui-aspect-ratio-helper.git
406 stars 66 forks source link

The aspect ratio sliders are broken #64

Open Proquror opened 1 year ago

Proquror commented 1 year ago

The extension breaks the resolution selection. My resolution selectors are limited to 512 and 2560. With this extension I somehow can set it less than 512, but it warps back to 512. And I can't select higher that 2048.

image

There are no errors in the console log.

How it shouldn't work: Q6dvSbS

How it should work: fea3383f-915d-498a-b995-5963ea5ab963

thomasasfk commented 1 year ago

Oh okay, I reckon we should pull the maximum/minimum from the options, and use defaults if undefined:

https://github.com/thomasasfk/sd-webui-aspect-ratio-helper/blob/main/javascript/aspectRatioController.js#L6-L7

const _MAXIMUM_DIMENSION = window.opts['txt2img/Width/maximum'] || 2048;
const _MINIMUM_DIMENSION = window.opts['txt2img/Width/minimum'] || 64;

Should also probably have a txt2img/img2img specific dimensions, rather than shared. Step should also probably be configurable, since it seems like it's a valid option. Also need to consider race conditions, as I think window.opts isn't immediately populated.

Apologies as I've not actually been keeping much up to date on the a1111 changes, but I'll try to implement these changes when I have a chance, open to pull requests if others want to give it a go though.

Danamir commented 1 year ago

I can confirm the bug is present on my system also. This line alone does not fix the issue, as the options are not always populated as you just mentioned :

const _MAXIMUM_DIMENSION = window.opts['txt2img/Width/maximum'] || 2048;

As a temporary fix I simply adjusted the line according to my needs :

const _MAXIMUM_DIMENSION = 2560;

Watching this issue for a more permanent fix.

Thanks for your extension !

Zullian commented 1 year ago

Can you tell me in which file did u change than line?

thomasasfk commented 1 year ago

Can you tell me in which file did u change than line?

Sorry, it was just an example to show what the eventual code may look like. I don't know if that line would just work. I've not found the time to implement this, but anyone else is free to give it ago, there is only 1 js file in the repo!