Skip to content
imaged

Image upscaling

Real-ESRGAN general v3 (x4)

Enlarges photos four times with sharp, clean detail: the compact general Real-ESRGAN, 1.2 million parameters. BSD-3-Clause.

BSD-3-Clausesuper-resolutionupscalingreal-esrganphoto restorationbsd-3-clause
Choose a variant

About this model

Real-ESRGAN enlarges a photo four times in width and height while removing the blur, noise and JPEG blocks of real-world images: it was trained on photos degraded the way phones, the web and old cameras degrade them.

General v3 is the compact version (a VGG-style network of 32 convolutions, 1.2 million parameters) made for speed. Its upstream script blends it by default with a denoising variant (denoise strength 0.5); this pack is the plain model (strength 1), which keeps more texture.

Photos of any size work: Slab cuts the photo into 256 x 256 tiles that overlap by 34 pixels, the model's reach, runs each one and stitches the centers. The result matches running the model on the whole photo to within one level of 255.

What you can build

  • Enlarge small or old photos for printing or a larger screen
  • Zoom into a crop of a photo
  • Clean up compressed images from the web or messaging apps
  • Upscale thumbnails and avatars

Goldfish

f16
Input
Carassius wild golden fish 2013 G1, reduced to a quarter of its size

George Chernilevsky, Public domain, https://commons.wikimedia.org/wiki/File:Carassius_wild_golden_fish_2013_G1.jpg

Output
Bicubic and Real-ESRGAN enlargements of the same crop, side by side
240 x 141 to 960 x 564 in 36 ms on Metal (FP16 pack). The crop shows bicubic enlargement on the left and the model on the right.

Street market

f16
Input
Fishmonger smiling, Maracaibo street market, Venezuela, reduced to a quarter of its size

Wilfredor, CC0, https://commons.wikimedia.org/wiki/File:Fishmonger_smiling,_Maracaibo_street_market,_Venezuela.jpg

Output
Bicubic and Real-ESRGAN enlargements of the same crop, side by side
240 x 159 to 960 x 636 in 36 ms on Metal (FP16 pack). The crop shows bicubic enlargement on the left and the model on the right.

Harbor boats

f16
Input
North Harbor Lysekil with motor boat, reduced to a quarter of its size

W.carter, Public domain, https://commons.wikimedia.org/wiki/File:North_Harbor_Lysekil_with_motor_boat.jpg

Output
Bicubic and Real-ESRGAN enlargements of the same crop, side by side
240 x 162 to 960 x 648 in 36 ms on Metal (FP16 pack). The crop shows bicubic enlargement on the left and the model on the right.

Variants & downloads

Choose the build for your app

Model files are hosted on Google Drive. Large files may open a confirmation page before downloading.

Small

Slab

Weights stored as int8 in blocks of 64. Slab decodes them to float when loading, so it runs at the same speed; images move more than with FP16 (see Accuracy).

Platforms: macos · android

realesrgan-x4v3-int8.slab

2.7 MB · Hosted download

Download
SHA-256 checksum
237220f0170dcc14a2166a5da9b5bae3ddf0c0668bf181ae7903f94f01b62977

LICENSE-Real-ESRGAN.txt

1 KB

Download
SHA-256 checksum
4a699ec4863d96a91fc265948a0c90033f7e8735d515524dcf3444736406e0c2
Conversion details
command
git clone https://github.com/xinntao/Real-ESRGAN && git -C Real-ESRGAN checkout a4abfb2979a7bbff3f69f58f58ae324608821e27 curl -LO https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-x4v3.pth python -c "import sys, types, importlib.util as u, torch; r = types.ModuleType('basicsr.utils.registry'); r.ARCH_REGISTRY = type('R', (), {'register': lambda self, *a, **k: (lambda c: c)})(); sys.modules.update({'basicsr': types.ModuleType('basicsr'), 'basicsr.utils': types.ModuleType('basicsr.utils'), 'basicsr.utils.registry': r}); s = u.spec_from_file_location('a', 'Real-ESRGAN/realesrgan/archs/srvgg_arch.py'); a = u.module_from_spec(s); s.loader.exec_module(a); m = a.SRVGGNetCompact(num_in_ch=3, num_out_ch=3, num_feat=64, num_conv=32, upscale=4, act_type='prelu'); m.load_state_dict(torch.load('realesr-general-x4v3.pth', map_location='cpu', weights_only=True)['params']); torch.onnx.export(m.eval(), torch.rand(1, 3, 256, 256), 'model.onnx', input_names=['input'], output_names=['output'], opset_version=17, dynamo=False)" # basicsr is stubbed: the arch file only uses its registry slab-load convert model.onnx model.slab --input input=1x3x256x256 --meta task=upscale --meta normalize=scale255 --meta color=rgb --meta tile_pad:i64=34 slab-load quantize model.slab realesrgan-x4v3-int8.slab slab-load meta set realesrgan-x4v3-int8.slab default_backend.macos=gpu

Integration examples

Python

python

import slab

cfg = slab.Config(cache_dir="/tmp/slab_cache", license=open("license.slablic.txt").read())
session = slab.Session(cfg, "realesrgan-x4v3-f16.slab", warmup=True)
photo = slab.Frame.open("photo.jpg")
result = session.run(slab.Input(frame=photo)).to_frame()   # Slab tiles the photo and stitches the result
print(photo.width, photo.height, "->", result.width, result.height)

Device & backend compatibility

Pack default: macos / GPU. The fastest backend on the Mac: 17 ms per tile, about 0.2 s for a 640 x 480 photo.

Available execution backends for Real-ESRGAN general v3 (x4)
PlatformEngineStatusPrecision
apple

CPU

CPU

Supported

Measured on macOS.

f32
apple

Metal

GPU

Supported

Measured on macOS. The default.

f32
apple

Apple Neural Engine

NPU

Supported

Measured on macOS. The Neural Engine computes in FP16.

f16
android

CPU

CPU

Supported

Measured on a Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2, Adreno 740), Android 17.

f32
android

Vulkan

GPU

Supported

Measured on a Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2, Adreno 740), Android 17.

f32
android

Qualcomm Hexagon NPU (QNN)

NPU

Not supported

Tried on a Samsung Galaxy S23 Ultra (Hexagon v73): Slab's QNN backend has no translation for DepthToSpace (the upscaling step) yet.

—

Performance

Results depend on the device, runtime, and test conditions. Each measurement keeps its own context.

Mac with Apple M1 Max

Slab · CPU

macOS 26.6.2

223.4 ms

Measured time · scope below

int8Session open (ms): 9 Platform: macos Runs: 100 Input: 1, 3, 256, 256 Measured: 2026-10-29

Median of 100 warm runs on one 256 x 256 tile (Slab's run time). A 640 x 480 photo, tiling, stitching and to_frame() included: 2652 ms median of 10.

Mac with Apple M1 Max

Slab · GPU

macOS 26.6.2

16.6 ms

Measured time · scope below

int8Session open (ms): 9 Platform: macos Runs: 100 Input: 1, 3, 256, 256 Measured: 2026-10-29

Median of 100 warm runs on one 256 x 256 tile (Slab's run time). A 640 x 480 photo, tiling, stitching and to_frame() included: 216 ms median of 10.

Mac with Apple M1 Max

Slab · NPU

macOS 26.6.2

39.2 ms

Measured time · scope below

int8Session open (ms): 6477 Platform: macos Runs: 100 Input: 1, 3, 256, 256 Measured: 2026-10-29

Median of 100 warm runs on one 256 x 256 tile (Slab's run time). A 640 x 480 photo, tiling, stitching and to_frame() included: 494 ms median of 10.

Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2)

Slab · CPU

Android 17

3.94 s

Measured time · scope below

int8Session open (ms): 16 Platform: android Runs: 10 Input: 1, 3, 256, 256 Measured: 2026-11-06

Median of 10 warm runs of the model (Slab's run time). open_ms: opening the session. Peak memory (resident) after the runs: 230 MB.

Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2)

Slab · GPU

Android 17

997.0 ms

Measured time · scope below

int8Session open (ms): 48 Platform: android Runs: 10 Input: 1, 3, 256, 256 Measured: 2026-11-06

Median of 10 warm runs of the model (Slab's run time). open_ms: opening the session with the GPU programs already in the cache folder (the first open on a device compiles them, about 0.3 s more). Peak memory (resident) after the runs: 200 MB.

Accuracy checks

macos · CPU · int8

Upstream RealESRGANer on the whole photo without tiling or padding, plain weights (denoise strength 1), output clamped and rounded to 8 bits; 8 public-domain and CC0 photos (Wikimedia Commons), compared as 8-bit images

PSNR 44.9 dB on average (38.7 dB on the worst photo); mean difference 1.048 levels of 255, largest 39; 8.74% of values off by more than 2.

macos · GPU · int8

Upstream RealESRGANer on the whole photo without tiling or padding, plain weights (denoise strength 1), output clamped and rounded to 8 bits; 8 public-domain and CC0 photos (Wikimedia Commons), compared as 8-bit images

PSNR 44.9 dB on average (38.7 dB on the worst photo); mean difference 1.048 levels of 255, largest 39; 8.74% of values off by more than 2.

macos · NPU · int8

Upstream RealESRGANer on the whole photo without tiling or padding, plain weights (denoise strength 1), output clamped and rounded to 8 bits; 8 public-domain and CC0 photos (Wikimedia Commons), compared as 8-bit images

PSNR 44.8 dB on average (38.7 dB on the worst photo); mean difference 1.051 levels of 255, largest 39; 8.81% of values off by more than 2.

Before you choose this model

  • It invents plausible detail rather than recovering real detail: do not use it where the detail must be true (evidence, documents, medical images).
  • Faces, text and fine patterns can look painted.
  • The output has 16 times the pixels: a 1920 x 1080 photo becomes 7680 x 4320 (33 megapixels, about 400 MB while Slab holds it in floating point). Best for small photos and crops.
  • Photos smaller than 256 pixels on a side are reflected to the tile size, so a few pixels along their edges differ from a whole-image run (up to 115 levels of 255 right at the border in our small examples), as with upstream's pre_pad option.
  • The int8 pack is barely smaller (3 MB against 4 MB) and visibly different (PSNR 45 dB, up to 39 levels): use FP16.