Skip to main content

Overview

AI Image Editor provides comprehensive image editing capabilities using AI. Modify, enhance, and transform images with text-based instructions for natural-looking results without manual editing tools.

How It Works

  1. Upload image - Provide the image you want to edit
  2. Describe changes - Use text to specify desired modifications
  3. AI processes - AI applies edits intelligently
  4. Download result - Retrieve your edited image

Use Cases

  • Photo editing - Quick modifications without manual tools
  • Object removal - Remove unwanted elements from images
  • Color adjustments - Change colors and tones
  • Style changes - Modify image aesthetics
  • Content addition - Add new elements to images

Best Practices

Editing Instructions

Be specific and clear - Detailed instructions produce more accurate edits.
  • Describe precisely - Specify exact changes wanted
  • One edit at a time - Better results with focused changes
  • Use descriptive language - Clear descriptions work best
  • Reference locations - Specify where changes should occur

Image Requirements

RequirementDetails
ResolutionMinimum 512x512 pixels
FormatPNG, JPG, JPEG, WEBP
QualityHigher quality enables better edits
ClarityClear images edit more accurately

Code Examples

Basic Image Edit

from magic_hour import Client
from os import getenv

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

result = client.v1.ai_image_editor.generate(
    assets={
        "image_file_path": "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/tomcruise.png"
    },
    style={
        "prompt": "Turn this image into studio ghibli style"
    },
    name="Image Editor image",
    wait_for_completion=True,
    download_outputs=True,
    download_directory="outputs"
)

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

API Reference

AI Image Editor API Reference

View full API specification