Cache images with CloudflareBuild a website with Next.jsBuild a Discord bot with PythonBuild an app with SwiftUIPush your own modelPush a Diffusers modelPush a Transformers modelPush a model using GitHub ActionsDeploy a custom modelGet a GPU machine
Home / Guides / Upscaling images

Upscaling images with Ultimate SD Upscale


Ultimate SD Upscale is an Automatic1111 extension by Coyote-A. It is a very powerful wrapper around ControlNet tile, giving fine control over all of the parameters, including:

  • denoising strength (ie how much of the original image remains in the final result)
  • target image size
  • opting into a first-pass upscaler before using ControlNet tile (for example Real-ESRGAN)
  • the order that tiles are processed in, linear or chessboard. Chessboard can reduce unwanted seams from showing
  • the size of the tiles
  • the amount of padding around each tile
  • the amount of blur applied to the tile masks (to hide seams where tiles are restitched together)
  • options for fixing seams after the ControlNet tile upscaling is complete

Using with ComfyUI

It has also been ported to ComfyUI as a custom node by ssitu. We recommend this in our ComfyUI guide as a must-have custom node in your workflow.

An ultimate SD upscale workflow

Run Ultimate SD Upscale with an API

User 'fewjative' has wrapped the ComfyUI custom node into a Replicate model that you can run with a production-ready API. Try out fewjative/ultimate-sd-upscale, or run it with an API using our guide below.

Alternatively, if you want to run your own customised ComfyUI workflow, one that incorporates Ultimate SD Upscale, you can use the fofr/any-comfyui-workflow model. Read our ComfyUI with an API guide to learn how.

Running Ultimate SD Upscale with Python

We’ll use fewjative/ultimate-sd-upscale for this example.

Start with our official Python client and read our getting started with Python docs.

pip install replicate
export REPLICATE_API_TOKEN=<your-api-token>

Run fewjative/ultimate-sd-upscale:

import replicate
 
output = replicate.run(
    "fewjative/ultimate-sd-upscale:latest",
    input={
        "image": "https://replicate.delivery/pbxt/KKOaCNy9baG5cUZfK3YvvePBqZeTxyvytifSo7pFOKLySQN2/ComfyUI_00004_.png",
        "steps": 20,
        "denoise": 0.4,
        "scheduler": "karras",
        "upscale_by": 2,
        "negative_prompt": "ugly, broken, weird",
        "positive_prompt": "a portrait photo of a cat in a green hoodie",
    }
)
 
# Save the output image
with open('output.png', 'wb') as f:
    f.write(output[0].read())

A more complete example, that incorporates all of the Ultimate SD Upscale parameters might look like this:

output = replicate.run(
    "fewjative/ultimate-sd-upscale:latest",
    input={
        "cfg": 8,
        "image": "https://replicate.delivery/pbxt/KKOaCNy9baG5cUZfK3YvvePBqZeTxyvytifSo7pFOKLySQN2/ComfyUI_00004_.png",
        "positive_prompt": "a portrait photo of a cat in a green hoodie",
        "negative_prompt": "ugly, broken, weird",
        "steps": 20,
        "denoise": 0.4,
        "sampler_name": "euler",
        "scheduler": "karras",
        "upscale_by": 2,
        "upscaler": "4x-UltraSharp",
        "controlnet_strength": 1,
        "use_controlnet_tile": True
        "mask_blur": 8,
        "mode_type": "Linear",
        "tile_width": 512,
        "tile_height": 512,
        "tile_padding": 32,
        "force_uniform_tiles": True,
        "seam_fix_mode": "None",
        "seam_fix_width": 64,
        "seam_fix_denoise": 1,
        "seam_fix_padding": 16,
        "seam_fix_mask_blur": 8,
    }
)
 
# Save the output image
with open('output.png', 'wb') as f:
    f.write(output[0].read())