# PhotoMaker

> Customizing Realistic Human Photos via Stacked ID Embedding


## Overview

- **Endpoint**: `https://fal.run/fal-ai/photomaker`
- **Model ID**: `fal-ai/photomaker`
- **Category**: image-to-image
- **Kind**: inference
**Tags**: editing, customization, realism, personalization



## Pricing

- **Price**: $0 per compute seconds

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`image_archive_url`** (`string`, _required_):
  The URL of the image archive containing the images you want to use.
  - Examples: "https://storage.googleapis.com/falserverless/model_tests/photomaker/elon.zip"

- **`prompt`** (`string`, _required_):
  The prompt to use for generating the image. Be as descriptive as possible for best results.
  - Examples: "instagram photo, portrait photo of a man img, colorful, perfect face, natural skin, hard shadows, film grain"

- **`base_pipeline`** (`BasePipelineEnum`, _optional_):
  The base pipeline to use for generating the image. Default value: `"photomaker"`
  - Default: `"photomaker"`
  - Options: `"photomaker"`, `"photomaker-style"`

- **`initial_image_url`** (`string`, _optional_):
  Optional initial image for img2img

- **`initial_image_strength`** (`float`, _optional_):
  How much noise to add to the latent image. O for no noise, 1 for maximum noise. Default value: `0.5`
  - Default: `0.5`
  - Range: `0` to `1`

- **`style`** (`StyleEnum`, _optional_):
   Default value: `"Photographic"`
  - Default: `"Photographic"`
  - Options: `"(No style)"`, `"Cinematic"`, `"Disney Character"`, `"Digital Art"`, `"Photographic"`, `"Fantasy art"`, `"Neonpunk"`, `"Enhance"`, `"Comic book"`, `"Lowpoly"`, `"Line art"`

- **`negative_prompt`** (`string`, _optional_):
  The negative prompt to use.Use it to address details that you don't want
  in the image. This could be colors, objects, scenery and even the small details
  (e.g. moustache, blurry, low resolution). Default value: `""`
  - Default: `""`
  - Examples: "nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry"

- **`num_inference_steps`** (`integer`, _optional_):
  Increasing the amount of steps tells Stable Diffusion that it should take more steps
  to generate your final result which can increase the amount of detail in your image. Default value: `50`
  - Default: `50`
  - Range: `20` to `100`

- **`style_strength`** (`integer`, _optional_):
   Default value: `20`
  - Default: `20`
  - Range: `15` to `50`

- **`num_images`** (`integer`, _optional_):
  Number of images to generate in one request. Note that the higher the batch size,
  the longer it will take to generate the images. Default value: `1`
  - Default: `1`
  - Range: `1` to `4`

- **`guidance_scale`** (`float`, _optional_):
  The CFG (Classifier Free Guidance) scale is a measure of how close you want
  the model to stick to your prompt when looking for a related image to show you. Default value: `5`
  - Default: `5`
  - Range: `0.1` to `10`

- **`seed`** (`integer`, _optional_):
  The same seed and the same prompt given to the same version of Stable Diffusion
  will output the same image every time.
  - Examples: 42



**Required Parameters Example**:

```json
{
  "image_archive_url": "https://storage.googleapis.com/falserverless/model_tests/photomaker/elon.zip",
  "prompt": "instagram photo, portrait photo of a man img, colorful, perfect face, natural skin, hard shadows, film grain"
}
```

**Full Example**:

```json
{
  "image_archive_url": "https://storage.googleapis.com/falserverless/model_tests/photomaker/elon.zip",
  "prompt": "instagram photo, portrait photo of a man img, colorful, perfect face, natural skin, hard shadows, film grain",
  "base_pipeline": "photomaker",
  "initial_image_strength": 0.5,
  "style": "Photographic",
  "negative_prompt": "nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry",
  "num_inference_steps": 50,
  "style_strength": 20,
  "num_images": 1,
  "guidance_scale": 5,
  "seed": 42
}
```


### Output Schema

The API returns the following output format:

- **`images`** (`list<Image>`, _required_)
  - Array of Image
  - Examples: [{"height":1024,"width":1024,"file_name":"87374b9db2b74f5792839b19d9b29a9a.png","file_size":1785567,"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/model_tests/photomaker/elon-output.png"}]

- **`seed`** (`integer`, _required_)



**Example Response**:

```json
{
  "images": [
    {
      "height": 1024,
      "width": 1024,
      "file_name": "87374b9db2b74f5792839b19d9b29a9a.png",
      "file_size": 1785567,
      "content_type": "image/png",
      "url": "https://storage.googleapis.com/falserverless/model_tests/photomaker/elon-output.png"
    }
  ]
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/photomaker \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "image_archive_url": "https://storage.googleapis.com/falserverless/model_tests/photomaker/elon.zip",
     "prompt": "instagram photo, portrait photo of a man img, colorful, perfect face, natural skin, hard shadows, film grain"
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "fal-ai/photomaker",
    arguments={
        "image_archive_url": "https://storage.googleapis.com/falserverless/model_tests/photomaker/elon.zip",
        "prompt": "instagram photo, portrait photo of a man img, colorful, perfect face, natural skin, hard shadows, film grain"
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("fal-ai/photomaker", {
  input: {
    image_archive_url: "https://storage.googleapis.com/falserverless/model_tests/photomaker/elon.zip",
    prompt: "instagram photo, portrait photo of a man img, colorful, perfect face, natural skin, hard shadows, film grain"
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/fal-ai/photomaker)
- [API Documentation](https://fal.ai/models/fal-ai/photomaker/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/photomaker)
- [GitHub Repository](https://github.com/TencentARC/PhotoMaker/blob/main/LICENSE)

### fal.ai Platform

- [Platform Documentation](https://docs.fal.ai)
- [Python Client](https://docs.fal.ai/clients/python)
- [JavaScript Client](https://docs.fal.ai/clients/javascript)
