stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Feature Request]: can you add width and height options to plotxy script

Open falon-go-weeee opened this issue 3 years ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What would your feature do ?

Each model behaves uniquely when we use different aspect ratios and resolutions. so it will be extremely beneficial to check a model's behavior.

Proposed workflow

  1. Go to .... Plotxy script
  2. select height/width from Xtype/Ytype
  3. enter the set of resolutions.
  4. Generate

Additional information

No response

falon-go-weeee avatar Dec 24 '22 15:12 falon-go-weeee

they may be a couple of scripts / extensions that could do this, check the wiki section. xy script is just another of those scripts that come with the repo, and are likely not top priority

ClashSAN avatar Dec 26 '22 01:12 ClashSAN

I want that function too, for high res fix, if high res is too high, the image looks crape, I want pick the highest resolution it can produce.

LanceGao97 avatar May 11 '23 04:05 LanceGao97

Doing a pretty hacky version of this is straightforward. In webui\scripts\xyz_grid.py, add this near the top with the other apply defs:

def apply_size():
    def fun(p, x, xs):
        setattr(p, 'width', int(x.split('x')[0]))
        setattr(p, 'height', int(x.split('x')[1]))

    return fun

then around line 225, add:

    AxisOption("Image Width", int, apply_field("width")),
    AxisOption("Image Height", int, apply_field("height")),
    AxisOption("Image Size", str, apply_size()),

Restart webui. This allows height and width to be specified separately, or overall size in the form <w>x<h> i.e. 832x1088.

Grids don't adjust to images with multiple sizes, they use the first image's size as the cell size. So to get a proper grid out of this, where nothing is cut off, you need to make sure the largest image is the first one generated (i.e. enter sizes in reverse order). There are improvements that could be made to this, notably that and also centering images within oversized grid cells/using a white background, but this will do for quick size comparisons.

disposabletiger avatar Jan 26 '24 21:01 disposabletiger

Implemented in https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15354

catboxanon avatar Mar 25 '24 16:03 catboxanon