Skip to main content

Overview

AI Headshot Generator creates professional-quality headshots from a single photo. The API generates multiple high-resolution headshots with different backgrounds, lighting, and professional styling while maintaining the person’s facial features and identity.

How It Works

  1. Provide a source photo - Upload a clear photo of the person
  2. Customize the style - Optionally specify background, attire, or style preferences
  3. API generates headshots - AI creates professional headshot variations
  4. Download results - Retrieve your professional headshots

Use Cases

  • LinkedIn profiles - Create polished professional photos
  • Corporate directories - Generate consistent employee headshots
  • Resume photos - Professional images for job applications
  • Acting portfolios - Multiple headshot variations from one photo
  • Social media profiles - Professional presence across platforms

Best Practices

Source Photo Requirements

Use a clear, front-facing photo - The AI needs to clearly see the person’s face for best results.
  • Good lighting - Even, natural lighting works best
  • Front-facing or slight angle - Avoid extreme profile shots
  • Clear face visibility - No sunglasses, masks, or heavy shadows
  • Neutral expression - Natural smile or neutral expression recommended
  • High resolution - At least 512x512 pixels for the face area

Style Customization

You can customize the output with prompts: ✅ Good prompts:
  • “Professional corporate headshot with neutral gray background”
  • “Friendly business casual with soft natural lighting”
  • “Executive portrait with dark blue suit”

Code Examples

Basic Headshot Generation

from magic_hour import Client
import os

client = Client(token=os.getenv("MAGIC_HOUR_API_KEY"))

result = client.v1.ai_headshot_generator.generate(
    assets={
        "image_file_path": "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/lebron.jpg"
    },
    style={
        "prompt": "Transform my selfie into a fresh but professional image suitable for Linkedin. The lighting should be natural, flattering, and multidimensional."
    },
    name="Professional Headshot",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="./outputs/"
)

if result.status == "complete":
    print(f"✅ Headshot 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 headshot50 credits

Resolution Limits

AI Headshot Generator has a maximum resolution of 1344px (either width or height).
Try this in our Google Colab Cookbook: Run this API with sample code. Just add your API key.

API Reference

AI Headshot Generator API Reference

View full API specification