stable-diffusion-xl-demo icon indicating copy to clipboard operation
stable-diffusion-xl-demo copied to clipboard

[suggestion] add aspect ratio options

Open YuenSzeHong opened this issue 1 year ago • 1 comments

colab dropdown, just turn it to html

 # @param ["1:1", "4:1", "16:9", "5:2", "2:1", "7:4", "3:2", "8:7", "9:8", "8:9", "7:8", "2:3", "4:7", "1:2", "2:5", "1:3", "9:16"] {allow-input: true}

python code

aspect_ratio = "9:16"
max_pixel = 1024*1024
w, h = (int(e) for e in aspect_ratio.split(':'))
width, height = (round(math.sqrt(max_pixel * x / y) / 8) * 8 for x, y in ((w, h), (h, w)))

width and height can be the param of the param of the model

YuenSzeHong avatar Aug 25 '23 14:08 YuenSzeHong

Great idea! Do you mind giving us a PR for this?

TonyLianLong avatar Oct 28 '23 05:10 TonyLianLong