Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add "resize by" and "resize to" tabs to img2img #9108

Merged
merged 2 commits into from
Apr 29, 2023
Merged

Conversation

AUTOMATIC1111
Copy link
Owner

For img2img interface, adds an option to resize the input image instead of having to specify resolution.

Looks like this:

firefox_4Ral8wH4WH

firefox_jdgiK7SWhR

modules/ui.py Outdated Show resolved Hide resolved
@SnowingIce
Copy link

SnowingIce commented Mar 29, 2023

Really appreciate it if someone could add a function similar to Hires.fix in txt2img.
i.e. Post process generated image from img2img.
Something like below
First Step: generate img2img with X steps
Second Step: apply Hires.fix with Y steps on output from the first step

It should be different from below

  1. Directly upscale an image (with no change on how it looks)
  2. Directly generate an upscaled image from beginning

Sorry to emphasize this but Hires.fix is quite useful which has less demand on GPU resource.
e.g. to generate image of size 960x1280, 1) is faster and also looks aesthetically better than 2)

  1. 30 steps on 640x960 + 10 steps of 1.5x upscale by Hires.fix
  2. 30 steps on 960x1280

This is a bit magical but it really looks so.

@missionfloyd
Copy link
Collaborator

@SnowingIce Isn't that more or less what upscaling with img2img does?

Have you tried doing it like this? Works pretty good.

@Danamir
Copy link

Danamir commented Mar 29, 2023

Following this PR. I really hope we will be able to choose an upscaler and latent upscaler to be applied by the resize (like in hrfix). As I'm still using my own updated local version of #6540 a lot.

@space-nuko
Copy link
Contributor

space-nuko commented Mar 29, 2023

I second having an upscaler dropdown in img2img for parity with HR fix.

Two things I noticed, first with "Send to img2img" from txt2img, the "resize from" text doesn't update from "no image selected" until you move the slider.

Second, I would like to have a way to have "Resize by" be the default tab when I open img2img, I don't think the selected tab can be configured with ui-config.json yet, worth adding?

@SnowingIce I think I understand what you mean now, this can be done by hand with "Send to img2img" on the img2img output. Maybe a custom script would be of use here? Would help ease the complexity of the UI

@SnowingIce
Copy link

SnowingIce commented Mar 29, 2023

@space-nuko Yes a script would also work pretty well.
Either of below should work equivalently.

  1. a script on txt2img for ControlNet, which supports a folder of images as input (currently, it can only work for single image as input)
  2. a script to achieve Highres.fix on img2img with batch processing

The technical goal is:
Given multiple images, to generate new image with ControlNet + Highres.fix

The practical use of it is:
To convert a bunch of images to another style, with precise control of picture and good resolution.

(There are something like gif2gif, but none incorporates ControlNet and Highres.fix)

Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
@AUTOMATIC1111 AUTOMATIC1111 changed the base branch from master to dev April 29, 2023 15:20
@AUTOMATIC1111 AUTOMATIC1111 merged commit b615a2e into dev Apr 29, 2023
4 checks passed
@AUTOMATIC1111 AUTOMATIC1111 deleted the img2img-scale-by branch May 1, 2023 11:19
@Zullian
Copy link

Zullian commented Jun 23, 2023

How can I increase maximum resolution in "Resize to" tab?

I tried manually changing it in "C:\sd.webui\webui\modules\ui.py" but it still doesn't go above 2048,
also I changed every 2048 to 16384 in "C:\sd.webui\webui\ui-config.json"

@Danamir
Copy link

Danamir commented Jun 23, 2023

Changing ui-config.json values should do the trick, after a full restart. Here are some examples for 2560 max dimension :

for txt2img :

    "txt2img/First pass width/value": 512,
    "txt2img/First pass width/minimum": 64,
    "txt2img/First pass width/maximum": 2560,
    "txt2img/First pass width/step": 64,
    "txt2img/First pass height/visible": true,
    "txt2img/First pass height/value": 512,
    "txt2img/First pass height/minimum": 64,
    "txt2img/First pass height/maximum": 2560,
    "txt2img/First pass height/step": 64,

    "txt2img/Resize width to/visible": true,
    "txt2img/Resize width to/value": 0,
    "txt2img/Resize width to/minimum": 0,
    "txt2img/Resize width to/maximum": 2560,
    "txt2img/Resize width to/step": 8,
    "txt2img/Resize height to/visible": true,
    "txt2img/Resize height to/value": 0,
    "txt2img/Resize height to/minimum": 0,
    "txt2img/Resize height to/maximum": 2560,
    "txt2img/Resize height to/step": 8,

and for img2img :

    "img2img/Width/value": 512,
    "img2img/Width/minimum": 64,
    "img2img/Width/maximum": 2560,
    "img2img/Width/step": 64,
    "img2img/Height/value": 512,
    "img2img/Height/minimum": 64,
    "img2img/Height/maximum": 2560,
    "img2img/Height/step": 64,

@Zullian
Copy link

Zullian commented Jun 23, 2023

It used to work before I updated and got tabs "Resize to" and "Resize by", now it doesn't work, I changed everywhere and works everywhere but here.

image

@Danamir
Copy link

Danamir commented Jun 23, 2023

You're right, I seem to have the same problem, which seems to be caused by the sd-webui-aspect-ratio-helper extension. The problem disappears if I disable the extension.

This is linked to this issue I guess : thomasasfk/sd-webui-aspect-ratio-helper#64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants