DEV Community

Cover image for How to Restore Old Photos with a Face Restoration API
AI Engine
AI Engine

Posted on • Originally published at ai-engine.net

How to Restore Old Photos with a Face Restoration API

Old photographs fade, scratch, and lose detail over time. A face restoration API uses deep learning to reconstruct facial details lost to age, compression, or low resolution — sharpening eyes, smoothing artifacts, and recovering natural textures.

What You Get

  • AI detail recovery with 2x upscale — Reconstructs eyes, eyebrows, lips, and skin texture
  • Single request, instant result — One POST, one permanent CDN URL back
  • Two modessingle (default) for portraits, all for group photos
  • Flexible input — Upload a file or pass a URL (JPEG, PNG, WebP)

Python Example

import requests

response = requests.post(
    "https://face-restoration.p.rapidapi.com/enhance-face",
    headers={
        "x-rapidapi-host": "face-restoration.p.rapidapi.com",
        "x-rapidapi-key": "YOUR_API_KEY",
    },
    data={
        "image_url": "https://example.com/old_photo.jpg",
        "mode": "single",
    },
)

data = response.json()
print(data["image_url"])      # Permanent CDN URL
print(data["faces_detected"]) # Number of faces enhanced
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "image_url": "https://images.ai-engine.net/face-restoration-api/abc123.jpg",
  "width": 2048,
  "height": 2048,
  "size_bytes": 160640,
  "faces_detected": 1
}
Enter fullscreen mode Exit fullscreen mode

Use Cases

  • Old family photos — Recover facial details from faded, scratched scans
  • Profile picture enhancement — Sharpen low-quality webcam shots or cropped group photos
  • Historical archives — Process entire collections programmatically
  • ID verification — Enhance low-quality passport/license scans for readability

Tips

  • Scan originals at 300+ DPI before sending to the API
  • Use mode=single for portraits (faster), mode=all for group photos
  • Combine with AI colorization to bring black-and-white photos to life

👉 Read the full tutorial with cURL, JavaScript examples and before/after demos

Top comments (0)