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.
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
f16George Chernilevsky, Public domain, https://commons.wikimedia.org/wiki/File:Carassius_wild_golden_fish_2013_G1.jpg
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
f16Wilfredor, CC0, https://commons.wikimedia.org/wiki/File:Fishmonger_smiling,_Maracaibo_street_market,_Venezuela.jpg
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
f16W.carter, Public domain, https://commons.wikimedia.org/wiki/File:North_Harbor_Lysekil_with_motor_boat.jpg
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 appModel files are hosted on Google Drive. Large files may open a confirmation page before downloading.
Standard
SlabWeights stored in FP16: half the size of FP32, the same images (see Accuracy).
Platforms: macos · android
realesrgan-x4v3-f16.slab
3.7 MB · Hosted download
SHA-256 checksum
456cd7968980bd78d18b8e170226f78c94774a64aebc7652b31af56f489bad9eLICENSE-Real-ESRGAN.txt
1 KB
SHA-256 checksum
4a699ec4863d96a91fc265948a0c90033f7e8735d515524dcf3444736406e0c2Conversion 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-f16.slab --f16 slab-load meta set realesrgan-x4v3-f16.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.
| Platform | Engine | Status | Precision |
|---|---|---|---|
| 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
226.2 ms
Measured time · scope below
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: 2688 ms median of 10.
Mac with Apple M1 Max
Slab · GPU
macOS 26.6.2
16.6 ms
Measured time · scope below
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
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: 493 ms median of 10.
Samsung Galaxy S23 Ultra (Snapdragon 8 Gen 2)
Slab · CPU
Android 17
3.66 s
Measured time · scope below
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
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 · f16
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 65.0 dB on average (62.3 dB on the worst photo); mean difference 0.022 levels of 255, largest 3; 0.00% of values off by more than 2.
macos · GPU · f16
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 65.0 dB on average (62.3 dB on the worst photo); mean difference 0.022 levels of 255, largest 3; 0.00% of values off by more than 2.
macos · NPU · f16
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 60.9 dB on average (60.0 dB on the worst photo); mean difference 0.054 levels of 255, largest 4; 0.00% 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.