> ## Documentation Index
> Fetch the complete documentation index at: https://docs.magichour.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Clothes Changer Tool - Magic Hour Docs

> Virtually try on different clothing items with realistic results.

export const ToolSection = ({type = "image", outputs = [], title = "", productSlug = "", apiSlug = ""}) => <>
    {outputs && outputs.length > 0 && <Tabs>
        {outputs.map((output, idx) => <Tab key={idx} title={`Example Output ${idx + 1}`}>
            <Frame>
              {type === "video" ? <video controls preload="metadata" playsInline className="rounded-lg h-80" src={`${output.src}#t=0.001`} type={`${output.src?.endsWith("mp4") ? 'video/mp4' : "video/webm"}`}>
                </video> : type === "audio" ? <audio controls preload="metadata" className="w-full" src={output.src}>
                  Your browser does not support the audio element.
                </audio> : <img height="320" className="rounded-lg h-80" src={output.src} />}
            </Frame>
          </Tab>)}
      </Tabs>}

    <CardGroup cols={2}>
      <Card title="API Spec" icon="webhook" horizontal href={`/api-reference/${type}-projects/${apiSlug}`}>
        See API details
      </Card>
      <Card title="Product Page" icon="video" horizontal href={`https://magichour.ai/products/${productSlug}`}>
        Learn more about {title}
      </Card>
    </CardGroup>

  </>;

## Overview

AI Clothes Changer lets you virtually try on different clothing items on a person in an image. The API uses advanced AI to realistically change outfits, styles, and clothing accessories while preserving the person's pose, lighting, and background.

<ToolSection
  title="AI Clothes Changer"
  productSlug="ai-clothes-changer"
  apiSlug="ai-clothes-changer"
  type="image"
  outputs={[
{
  src: "https://d28dkohlqf5vwj.cloudfront.net/products/ai-clothes-changer/professional-grade-outfit-changes.webp",
},
{
  src: "https://d28dkohlqf5vwj.cloudfront.net/products/ai-clothes-changer/test-and-iterate-faster.webp",
},
]}
/>

## How It Works

1. **Provide a person image** - Upload an image of the person you want to dress
2. **Provide a garment image** - Upload an image of the clothing item you want to try on
3. **Specify garment type** - Indicate whether it's upper\_body, lower\_body, or full\_body
4. **API generates the result** - AI applies the garment to the person realistically
5. **Download the result** - Retrieve your image with the new outfit

## Use Cases

* **E-commerce virtual try-on** - Let customers preview outfits before buying
* **Fashion design** - Prototype clothing designs on models
* **Social media content** - Create outfit inspiration posts
* **Personal styling apps** - Build virtual wardrobe features
* **Marketing campaigns** - Generate product variations efficiently

## Best Practices

### Image Quality

<Tip>
  **Use clear, full-body or half-body shots** - The AI works best when the person's clothing is
  clearly visible.
</Tip>

* **Good lighting** - Well-lit images produce more realistic results
* **Visible clothing area** - Ensure the clothing you want to change is fully visible
* **Minimal obstructions** - Avoid crossed arms or objects covering clothing
* **Simple backgrounds** - Solid or simple backgrounds work best

### Garment Image Requirements

**✅ Good garment images:**

* Clear, well-lit photos of the clothing item
* Flat lay or on a mannequin works best
* Minimal background distractions
* Full view of the garment

**Garment Types:**

* `upper_body` - Shirts, jackets, tops, blouses
* `lower_body` - Pants, skirts, shorts
* `full_body` - Dresses, jumpsuits, full outfits

## Code Examples

### Basic Clothes Change

<CodeGroup>
  ```python Python theme={null}
  from magic_hour import Client
  import os

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

  result = client.v1.ai_clothes_changer.generate(
      assets={
          "person_file_path": "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/freedom.jpg",
          "garment_file_path": "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/michael-jackson-red-jacket.png",
          "garment_type": "upper_body"
      },
      name="Clothes Changer image",
      wait_for_completion=True,
      download_outputs=True,
      download_directory="."
  )

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

  ```javascript Node.js theme={null}
  import { Client } from "magic-hour";

  const client = new Client({ token: process.env.MAGIC_HOUR_API_KEY });

  const result = await client.v1.aiClothesChanger.generate({
    assets: {
      personFilePath:
        "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/rookiesteph.jpg",
      garmentFilePath:
        "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/bullsjersey.webp",
      garmentType: "upper_body",
    },
    name: "Clothes Changer image",
    waitForCompletion: true,
    downloadOutputs: true,
    downloadDirectory: ".",
  });

  console.log(`✅ Clothes change complete!`);
  console.log(`Status: ${result.status}`);
  console.log(`Downloaded to: ${result.downloadedPaths}`);
  ```
</CodeGroup>

### Different Garment

<CodeGroup>
  ```python Python theme={null}
  result = client.v1.ai_clothes_changer.generate(
      assets={
          "person_file_path": "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/bullsjersey.webp",
          "garment_file_path": "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/rookiesteph.jpg",
          "garment_type": "upper_body"
      },
      name="Clothes Changer image",
      wait_for_completion=True,
      download_outputs=True,
      download_directory="."
  )

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

  ```javascript Node.js theme={null}
  const result = await client.v1.aiClothesChanger.generate({
    assets: {
      personFilePath:
        "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/bullsjersey.webp",
      garmentFilePath:
        "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/rookiesteph.jpg",
      garmentType: "upper_body",
    },
    name: "Clothes Changer image",
    waitForCompletion: true,
    downloadOutputs: true,
    downloadDirectory: ".",
  });

  console.log(`✅ Downloaded to: ${result.downloadedPaths}`);
  ```
</CodeGroup>

## Pricing

| Output           | Credits    |
| :--------------- | :--------- |
| 1 clothes change | 25 credits |

## Resolution Limits

AI Clothes Changer has a maximum resolution of **1472px** (either width or height).

<Tip>
  **Try this in our Google Colab Cookbook:** [Run this API with sample
  code](https://colab.research.google.com/drive/1NTHL_lr_s-qBJ-mSecSXPzRLi9_V5JiU?usp=sharing). Just
  add your API key.
</Tip>

## API Reference

<Card title="AI Clothes Changer API Reference" icon="webhook" href="/api-reference/image-projects/ai-clothes-changer">
  View full API specification
</Card>

## Related Tools

<CardGroup cols={2}>
  <Card title="AI Headshot Generator" icon="user" href="/tools/image/headshot-generator">
    Generate professional headshots
  </Card>

  <Card title="Image Background Remover" icon="image" href="/tools/image/background-remover">
    Remove backgrounds from images
  </Card>
</CardGroup>
