Supercharge Your Image Resolution with Real-ESRGAN: A Complete Guide

The ultimate guide to understanding and using the Real-ESRGAN AI model for high-quality image enhancement

Supercharge Your Image Resolution with Real-ESRGAN: A Complete Guide
Let's see how to use NightmareAI's Real-ESRGAN to enhance photo quality

Have you ever felt the frustration of a brilliant image destroyed by low resolution? A photo from an old phone, a screenshot gone wrong, or a valuable archival image, the promise of high-quality marred by pixellation? Well, you're in luck. Enter Real-ESRGAN, an AI model that offers high-quality image enhancement, even for those incredibly low-res photos you thought were beyond rescue.

This guide will walk you through the magic of the Real-ESRGAN model, explain its inputs and outputs, and teach you how to use it step-by-step to solve your image resolution nightmares. And hey, it's not just another model - Real-ESRGAN is ranked number 10 in popularity on, making it one of the go-to choices for image enhancement. And, as a cherry on top, we'll show you how to use to find similar models and decide which one best suits your creative endeavours. So, buckle up and let's dive in!

About the Real-ESRGAN

The Real-ESRGAN model, created by the skilled NightmareAI, is a marvel in the world of image-to-image conversion. It's specifically designed to upscale images while maintaining (or even enhancing) their quality. ESRGAN stands for Enhanced Super-Resolution Generative Adversarial Network. In simple terms, it uses artificial intelligence to generate a high-resolution image from a low-resolution input, a process known as 'super-resolution'. You can find more details about the model on its details page.

What sets Real-ESRGAN apart is its option for face correction and adjustable upscale. So, if you have a pixelated selfie or a blurry family photo, Real-ESRGAN can not only enhance the overall image but can also apply specific enhancements to faces. This capability makes it perfect for revitalizing old photos, enhancing social media images, and more. With a cost of just $0.00605 per run and an average run time of only 11 seconds, Real-ESRGAN provides an affordable and efficient solution for image enhancement.

Breathe New Life into Old Photos with AI: A Beginner’s Guide to GFPGAN
Are you ready to explore the magic of AI in photo restoration? Let’s get started!

How Real-ESRGAN Works - A Technical Overview

Let's delve a bit deeper into the nuts and bolts of Real-ESRGAN. The details here are sourced from the original research paper, in case you're interested in a more comprehensive read.

At its core, Real-ESRGAN aims to solve a problem in the domain of blind super-resolution, which is the process of enhancing low-resolution images that have been subjected to unknown and complex degradations. Simply put, its goal is to improve the quality of blurry or pixelated images.

One of the defining aspects of Real-ESRGAN is its training process. Unlike other models, it is trained with synthetic data, which is data that has been artificially created to mimic real-world scenarios. This doesn't mean the data is of lesser quality; it just means it's been created rather than collected from real-world images.

To simulate complex real-world degradations, Real-ESRGAN incorporates a high-order degradation modeling process. This allows the model to better account for the variety of ways an image might be degraded in a real-world setting.

Moreover, the model is designed to account for common artifacts that can occur during the image synthesis process, such as ringing and overshoot. These are disruptions that can affect the quality of the resulting image.

On top of these features, Real-ESRGAN uses a U-Net discriminator with spectral normalization. The discriminator's role is to distinguish between the model's outputs and real images. By using a U-Net architecture, the discriminator's ability is enhanced and the training dynamics are stabilized.

Through numerous comparisons, Real-ESRGAN has proven to perform exceptionally well on various real datasets, outperforming prior models in the domain of image enhancement.

Lastly, Real-ESRGAN can efficiently synthesize training pairs on the fly, adding an extra layer of efficiency to the whole process.

In summary, Real-ESRGAN works by leveraging advanced techniques and architectures to convert low-resolution images into high-quality ones. It's a potent blend of mathematics and computational power that brings this transformation to life.

Understanding the Inputs and Outputs of Real-ESRGAN

Before we start enhancing our images, it's important to understand how to communicate with Real-ESRGAN, and that's through its inputs and outputs.


Real-ESRGAN accepts two types of inputs:

  1. Image file: This is the image you want to enhance. Simply put, it's your low-resolution input image.
  2. Scale number: This is the factor by which you want to scale your image. The default value is 4, but you can adjust it as per your needs.
  3. Face Enhance: A boolean value (true/false). When set to true, the model applies specific enhancements to faces in the image.


The output of Real-ESRGAN is quite simple. It returns a string that represents a URI where you can find your enhanced image.

Now that we're familiar with how to talk to Real-ESRGAN let's move to the fun part - using it to enhance our images!

A Step-by-Step Guide to Using Real-ESRGAN

It's time to witness the magic of AI-powered image enhancement. You can interact directly with the model's "demo" on Replicate via their UI

if you're not feeling like dealing with code right now. You can use this link to play with the model's parameters and get some quick feedback.

Step 1: Install the Node.js client

First, we need to install the Replicate client for Node.js by running the following command:
npm install replicate

Step 2: Authenticate using your API token

Next, copy your API token and authenticate by setting it as an environment variable:
export REPLICATE_API_TOKEN=[token]

Step 3: Run the model

With everything set up, we're ready to run the model. Here's a simple example of how you can do it:

import Replicate from "replicate";

const replicate = new Replicate({
  auth: process.env.REPLICATE_API_TOKEN,

const output = await
    input: {
      image: "..." // replace with your image

Setting a Webhook

If you want to get notified when your prediction is ready, you can specify a webhook URL. Here's how to do it:

const prediction = await replicate.predictions.create({
  version: "42fed1c4974146d4d2414e2be2c5277c7fcf05fcc3a73abf41610695738c1d7b",
  input: {
    image: "..." // replace with your image
  webhook: "",
  webhook_events_filter: ["completed"]

Taking it Further - Finding Other Image-to-Image Models with is a goldmine for discovering AI models that cater to a wide range of needs. From image generation to image-to-image conversion, it offers a searchable, filterable, tagged database of all the models on Replicate. If you're interested in finding similar models to Real-ESRGAN, here's how to go about it:

Step 1: Visit

Head over to to begin your search for similar models.

Use the search bar at the top of the page to search for models with specific keywords, such as "super resolution" or "image enhancement". This will show you a list of models related to your search query.

Step 3: Filter the Results

On the left side of the search results page, you'll find several filters that can help you narrow down the list of models. You can filter and sort by models by type (Image-to-Image, Text-to-Image, etc.), cost, popularity, or even specific creators.

Finding additional Image-to-Image upscalers on


In this guide, we dove deep into the workings of the Real-ESRGAN model, learned how to use it to enhance our images, and even explored how to find similar models using We also discovered how to leverage the search and filter features in to find models that best suit our needs, broadening our horizons in the world of AI-powered image enhancement.

I hope this guide has inspired you to explore the creative possibilities of AI and bring your imagination to life. Don't forget to subscribe for more tutorials, updates on new and improved AI models, and a wealth of inspiration for your

next creative project. You can stay updated on my latest musings on AI over on my Twitter, and don't forget to check out more guides and resources at Happy image enhancing, and here's to your journey into the world of AI with!

Subscribe or follow me on Twitter for more content like this!