AI images

How to Upscale Images Locally with Real-ESRGAN

3 min read

Real-ESRGAN is still the workhorse for local upscaling. Use the ncnn-vulkan build, not the Python package: pip install realesrgan pulls in basicsr, which imports torchvision.transforms.functional_tensor — removed in torchvision 0.17 — so a fresh install fails with an ImportError before it upscales anything.

The standalone binary has no such problem. It is a single self-contained executable that talks to your GPU through Vulkan, so Intel, AMD and NVIDIA cards all work and CUDA is not involved. The catch: it is frozen at v0.2.0 (April 2022). It is unmaintained, and it still works.

1. Download

Grab the zip for your OS from the releases page of xinntao/Real-ESRGAN-ncnn-vulkan — -windows.zip, -macos.zip or -ubuntu.zip — and unzip it. The archive contains the executable plus a models folder; keep them together.

chmod +x realesrgan-ncnn-vulkan

macOS and Linux only: makes the extracted binary runnable. On macOS you may also need to allow it once in System Settings → Privacy & Security.

2. Upscale one image

./realesrgan-ncnn-vulkan -i input.jpg -o output.png -n realesrgan-x4plus
.\realesrgan-ncnn-vulkan.exe -i input.jpg -o output.png -n realesrgan-x4plus

Reads one image, writes a 4x larger one. Output format follows the extension of -o; PNG keeps the detail you just paid for.

3. Pick the model

-n selects the weights, and this choice matters far more than any other flag:

-n valueUse for
realesrgan-x4plusPhotos, scans, real-world images
realesrgan-x4plus-animeAnime and illustration — smaller and faster
realesr-animevideov3Anime video frames; the only model with 2x and 3x weights
realesrnet-x4plusPhotos, less aggressive sharpening

-s sets the scale (2, 3 or 4, default 4), but the x4plus models only ship 4x weights — asking them for 2x will not help. Out of GPU memory on a large image? Add -t 128 to process it in tiles.

4. Batch a folder

mkdir -p out
./realesrgan-ncnn-vulkan -i in -o out -n realesrgan-x4plus -f png

Point -i and -o at directories instead of files and every image in in is processed into out. -f png forces the output format for the whole run. The output directory must exist first — the tool will not create it.

Want a GUI over the same models, still offline? Upscayl wraps this exact binary.


Next: remove a background with AI or generate the image in the first place.

Open the full interactive version (with copy buttons) ↗

← All guides