CodeFormer
Robust face restoration with an adjustable fidelity–quality trade-off.
- Stars
- 18.2K
- Forks
- 3.7K
- Open issues
- 283
- Last commit
- 2025-11-18
Live from the GitHub API · updated 2026-10-15
What is CodeFormer?
CodeFormer restores faces using a learned codebook prior and lets you tune how faithful the result stays to the input. It also handles colorization and inpainting of faces. Note the non-commercial S-Lab license.
Key features
- Fidelity weight slider (-w) to balance realism vs. likeness
- Face colorization and inpainting
- Whole-image and video support
System requirements
- Platforms
- Windows · macOS · Linux
- GPU
- NVIDIA recommended
- Python
- 3.8
How to install CodeFormer
Summarized from the project’s README. Projects change quickly — check the GitHub page for the latest instructions.
Python
- 1Clone and install.
git clone https://github.com/sczhou/CodeFormer cd CodeFormer pip install -r requirements.txt python basicsr/setup.py develop - 2Download the pretrained models and restore a folder of photos.
python scripts/download_pretrained_models.py facelib python scripts/download_pretrained_models.py CodeFormer python inference_codeformer.py -w 0.7 --input_path inputs/whole_imgs
Strengths
- Excellent on heavily degraded faces
- Adjustable fidelity
Limitations
- Non-commercial license
CodeFormer alternatives compared
| Software | Stars | License | Platforms | VRAM |
|---|---|---|---|---|
| CodeFormer Robust face restoration with an adjustable fidelity–quality trade-off. | 18.2K | S-Lab License 1.0 (non-commercial) | — | |
| GFPGAN Blind face restoration for old and low-quality photos. | 37.7K | Apache-2.0 | — | |
| Real-ESRGAN Practical image and video super-resolution models. | 37.1K | BSD-3-Clause | — | |
| Upscayl Free desktop app that upscales images with AI. | 50.6K | AGPL-3.0 | — | |
| rembg Remove image backgrounds from the command line, Python or an HTTP server. | 25.1K | MIT | — | |
| BiRefNet High-resolution dichotomous segmentation — state-of-the-art background removal. | 4.3K | MIT | — |
FAQ
Is CodeFormer free?
Yes — CodeFormer is open-source software released under the S-Lab License 1.0 (non-commercial) license. Check the license (and any model weight licenses) before commercial use.
Does CodeFormer run on Windows, Mac and Linux?
CodeFormer supports: Windows, macOS, Linux.
What hardware do I need for CodeFormer?
NVIDIA recommended
How do I install CodeFormer?
1. Clone and install. 2. Download the pretrained models and restore a folder of photos.
What are the best CodeFormer alternatives?
Popular alternatives include GFPGAN, Real-ESRGAN, Upscayl, rembg. See the comparison table on this page.
Can I use CodeFormer online without installing it?
If you just want results, AiLoft runs top image models such as GPT Image 2.5 and Nano Banana Pro in the browser — no GPU or setup required.
Skip the install — generate images in your browser
No GPU, drivers or Python needed. Use GPT Image 2.5 and Nano Banana Pro online and compare them side by side.