Skip to content

How to upscale images

stassius edited this page May 29, 2023 · 7 revisions

Why can't I just generate a high resolution image?

Most models were trained on relatively low-res pictures. So if you will try to generate an image with higher width or height you could get so called "cloning artifacts". Your objects will be cloned and people could have an extra head.

image

Some of the models could work with images of higher resolution. For example, DreamShaper can generate 960x544 images. Note that both width and height should be divisible by 8.

In order to get a crisp and detailed FullHD or 4K image you have to use some tricks.

Hires fix

If you're using text2image mode, tick the Hires fix checkbox. After the image finished generating, Hires fix will upscale it with the chosen upscaler and make another pass of image2image with the same prompt on this image to add minor details, that could be lost after the upscaling.

I'd suggest to use relatively low denoising strength (0.1-0.35) to keep the overall image composition. Note that the resolution you can use here is limited by the amount of VRAM you have.

image

This is my favorite method of getting FullHD images. Remember, that the resolution should be dividable by 8. Put initial resolution like 960x544. Use the DreamShaper model. On other models you may have to decrease the initial resolution. Add Hires fix with R-Esrgan or ScuNet upscaler, factor of 2, and low denoising strength (0.2-0.35). After the generation you will get a 1920x1088 image with sharp details.

Here is an example image I generated using this technique (right click - open image to see full-res):

00011-2179382355

SD Upscale node

You can use SD Upscale node. It gives you standard upscaler options from the Extras tab in Automatic1111 webui. This way you can reconstruct the Hires fix functionality - just add the SD Upscale and append with another SD Dream node in image2image mode with low denoising. To do this tick the Overwrite File Attribute checkbox.

image

You can create quite a complex upscaling setup. For example, upscale with a lower scale factor first, append SD Dream to add details, than upscale with another node even more if your VRAM allows it.

Ultimate SD Upscale

If your GPU has low VRAM, you can use Ultimate SD Upscale script. It will split your image to low-res tiles, scale them one by one and stitch the result back together. It obviously takes more time, but this way you can get a 4K image on 8Gb GPU.

First generate your standard low-res image with SD Dream node. Put SD Prompt node before it to save the prompt for the next pass.

Add an SD Script node, choose "ultimate sd upscale". Try next settings for 4096x4096 image from 512x512 generation.

image image

Don't use Seams fix. You can try it if you got a noticeable grid-like pattern.

After that append an SD Dream node in image2image mode. Use low denoising strength (0.12-0.2). Use upstream Attribute as the prompt source. Add one ControlNet. Preprocessor should be "none" and the model should be "control_v11_sd15_tile".

Here is the crop of the image upscaled to 4096x4096 this way.

image

Initial image:

lowres_0