Skip to main content

Overview

Photo Colorizer brings black and white photos to life by adding realistic, historically accurate colors using AI. The API analyzes image content and applies appropriate colors based on context, lighting, and typical color patterns.

How It Works

  1. Upload B&W photo - Provide a black and white or grayscale image
  2. AI analyzes - AI understands context and appropriate colors
  3. Colors applied - Realistic colors added throughout image
  4. Download result - Retrieve your colorized photo

Use Cases

  • Photo restoration - Restore color to family photos
  • Historical archives - Colorize historical photographs
  • Artistic projects - Add color to vintage imagery
  • Documentation - Modernize old photographic records
  • Memory preservation - Bring old memories to life

Best Practices

Photo Selection

Use high-quality scans - Better source images produce more accurate colorization.
  • Clear contrast - Good grayscale contrast helps color accuracy
  • High resolution - More detail enables better colorization
  • Clean scans - Remove dust and damage first if possible
  • Sharp focus - Clearer images colorize more accurately

Colorization Quality

Photo TypeColorization Quality
PortraitsExcellent - faces colorize very naturally
LandscapesExcellent - natural scenes work well
ArchitectureGood - buildings and structures
ObjectsGood - everyday items
Complex scenesVariable - depends on clarity

Code Examples

Colorize Black & White Photo

from magic_hour import Client
from os import getenv

client = Client(token=getenv("API_TOKEN"))

result = client.v1.photo_colorizer.generate(
    assets={
        "image_file_path": "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/v-j-day-in-times-square.jpg"
    },
    name="Photo Colorizer image",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="outputs"
)

if result.status == "complete":
    print(f"✅ Colorization complete!")
    print(f"Downloaded to: {result.downloaded_paths}")
    print(f"Credits charged: {result.credits_charged}")
else:
    print(f"❌ Job failed with status: {result.status}")
    if hasattr(result, 'error_message'):
        print(f"Error: {result.error_message}")

Pricing

OutputCredits
1 colorized image10 credits
Try this in our Google Colab Cookbook: Run this API with sample code. Just add your API key.

API Reference

Photo Colorizer API Reference

View full API specification