Stable Diffusion Upscale

Upscale the initial image to given shape. You can choose to restore the face within the image by turn up the visibility of gfpgan and codeformer (with upscaling_resize_ratio to 1)

Try it in the Widget Center

Click this url to try this widget and copy the Pro Config template.

Usage

Scale up the original image to the specified shape. You can opt to restore the face within the image by increasing the visibility of GFPGAN and Codeformer.

Input Parameters

NameTypeDescriptionDefaultRequired

image

string

The input image, can be a url or base64 sting

resize_mode

integer

Sets the resize mode: 0 to upscale by upscaling_resize amount, 1 to upscale up to upscaling_resize_h x upscaling_resize_w.

0

gfpgan_visibility

number

Sets the visibility of GFPGAN, values should be between 0 and 1. Use for face restoring

0

codeformer_visibility

number

Sets the visibility of CodeFormer, values should be between 0 and 1. Use for face restoring

0

codeformer_weight

number

Sets the weight of CodeFormer, values should be between 0 and 1. Use for face restoring

0

upscaling_resize_ratio

number

By how much to upscale the image, only used when resize_mode=0.

2

upscaling_resize_w

integer

Target width for the upscaler to hit. Only used when resize_mode=1.

512

upscaling_resize_h

integer

Target height for the upscaler to hit. Only used when resize_mode=1.

512

upscaler_1

string

The name of the main upscaler to use

ESRGAN_4x

upscaler_2

string

The name of the secondary upscaler to use. Set to 'None' for quick upscale. The result will be a fusion of two model, decided by `extras_upscaler_2_visibility`.

None

extras_upscaler_2_visibility

number

Sets the visibility of secondary upscaler, values should be between 0 and 1.

0

upscale_first

boolean

Should the upscaler run before restoring faces?

False

Output Parameters

NameTypeDescriptionFile Type

url

string

The url of generated image, stored in the cloud. Only temporarily effective, will be cleared in a few hours.

image

Output Example

{
  "url": "https://image.myshell.ai/image/chat/embed_obj/40295/20240423/29381f8ee23144a69e88a64fa8232fca.jpg"
}

Detailed Guidelines

  • Upscale (SuperResolution)

    • Main parameter:

      • image : The input image, can be a url or base64 sting. Any size

      • resize_mode: Sets the resize mode: 0 to upscale by upscaling_resize amount, 1 to upscale up to upscaling_resize_h x upscaling_resize_w.

      • upscaling_resize_ratio : By how much to upscale the image, only used when resize_mode=0.

      • upscaling_resize_w & upscaling_resize_h: Target width/height for the upscaler to hit. Only used when resize_mode=1. Change the ratio of with/height will casuing a center crop of generated images

      • upscaler_1 : The name of the main upscaler to use, choose ["None", "Lanczos", "Nearest", "ESRGAN_4x", "LDSR", "R-ESRGAN 4x+", "R-ESRGAN 4x+ Anime6B", "ScuNET GAN", "ScuNET PSNR", "SwinIR 4x"]

      • upscaler_2: The name of the secondary upscaler to use. Set to 'None' to disable. The result will be a fusion of two model, decided by extras_upscaler_2_visibility

      • extras_upscaler_2_visibility: Sets the visibility of secondary upscaler, values should be between 0 and 1. The result will be final = (1-α) image_a + α image_b

    • Other functional parameter:

      • gfpgan_visibility : Sets the visibility of GFPGAN, values should be between 0 and 1. Use for face restoring. 0 for disabled. The result will be a fusion addition

      • codeformer_visibility && codeformer_weight : Sets the visibility and weight of CodeFormer, values should be between 0 and 1. Use for face restoring. The result will be a fusion addition

      • upscale_first : Should the upscaler run before restoring faces? default to False

Last updated