Skip to main content

Overview

AI Face Editor provides advanced facial editing capabilities using AI to modify and enhance facial features with natural-looking results. The API can adjust expressions, features, and attributes while maintaining realistic proportions and lighting.

API Spec

See API details

Product Page

Learn more about AI Face Editor

How It Works

  1. Upload photo - Provide an image with a clear face
  2. Specify edits - Describe desired facial modifications
  3. AI processes - AI applies edits while maintaining natural appearance
  4. Download result - Retrieve your edited image

Use Cases

  • Portrait enhancement - Improve and refine facial features
  • Expression modification - Adjust facial expressions
  • Beauty editing - Apply natural-looking enhancements
  • Photo restoration - Improve quality of facial photos
  • Creative projects - Experiment with facial modifications

Best Practices

Photo Requirements

Use high-quality, well-lit photos - Better source images produce superior editing results.
  • Clear facial features - All features should be visible
  • Good lighting - Even lighting produces better results
  • Front-facing preferred - Works best with frontal angles
  • High resolution - At least 512x512 pixels recommended

Edit Guidelines

Edit TypeBest Practice
Feature adjustmentsMake subtle, natural changes
Expression changesMaintain facial structure
EnhancementsKeep edits realistic
Multiple editsApply one change at a time

Code Examples

Add Natural Smile

from magic_hour import Client
from os import getenv

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

result = client.v1.ai_face_editor.generate(
    assets={
        "image_file_path": "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/tomcruise.png"
    },
    style={
        "enhance_face": False,
        "eye_gaze_horizontal": 0.0,
        "eye_gaze_vertical": 0.0,
        "eye_open_ratio": 0.0,
        "eyebrow_direction": 100, # Raise eyebrows
        "head_pitch": 0.0,
        "head_roll": 0.0,
        "head_yaw": 0.0,
        "lip_open_ratio": 0.0,
        "mouth_grim": 0.0,
        "mouth_position_horizontal": 0.0,
        "mouth_position_vertical": 0.0,
        "mouth_pout": 0.0,
        "mouth_purse": 0.0,
        "mouth_smile": 0.0,
    },
    name="Face Editor image",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="."
)

if result.status == "complete":
    print(f"✅ Face edit 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}")

Raise Eyebrows and Make Mouth Pout

result = client.v1.ai_face_editor.generate(
    assets={
        "image_file_path": "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/tomcruise.png"
    },
    style={
        "enhance_face": False,
        "eye_gaze_horizontal": 0.0,
        "eye_gaze_vertical": 0.0,
        "eye_open_ratio": 0.0,
        "eyebrow_direction": 100, # Raise eyebrows
        "head_pitch": 0.0,
        "head_roll": 0.0,
        "head_yaw": 0.0,
        "lip_open_ratio": 0.0,
        "mouth_grim": 0.0,
        "mouth_position_horizontal": 0.0,
        "mouth_position_vertical": 0.0,
        "mouth_pout": 100, # Make Mouth Pout
        "mouth_purse": 0.0,
        "mouth_smile": 0.0,
    },
    name="Face Editor image",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="."
)

if result.status == "complete":
    print(f"✅ Face edit 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 edited image1 credits
Try this in our Google Colab Cookbook: Run this API with sample code. Just add your API key.

API Reference

AI Face Editor API Reference

View full API specification

AI Headshot Generator

Generate professional headshots

AI Image Editor

Edit and modify full images