Build a website with Next.jsBuild a Discord bot with PythonBuild an app with SwiftUIPush your own modelPush a Diffusers modelPush a Transformers modelPush a model using GitHub ActionsDeploy a custom modelGet a GPU machine
Home / Guides

Generate photos of real people with Photomaker


TencentARC PhotoMaker is an AI tool that allows you to:

  • make realistic photos of real people instantly (without needing to train a LoRA or fine-tune a model)
  • maintain likenesses from images even in different styles and poses
  • generate images of people with a strong likeness using any SDXL base model or fine-tune

You can run PhotoMaker on Replicate. This is a photorealistic model that uses RealVisXL V3.0 as the SDXL base weights.

There’s also a styled PhotoMaker that uses SDXL Unstable Diffusers to make 3D renders of people.

An example

In this example we show an input photo of Yann LeCun, a famous computer scientist, and we generate a new photo of him receiving a Nobel Prize.

You can see how well PhotoMaker maintains the likeness of the input from a single image.

Input
prompt
A close-up photo of a scientist img receiving the Nobel Prize
Output

How to use PhotoMaker

Use multiple images for best results

PhotoMaker takes 1 or more images as input and generates a new image based on a prompt. To get the best likeness in your results we recommend using 4 input images of the same person.

Include the trigger word

Your prompt must include the trigger word to activate PhotoMaker. In all of Replicate’s models the trigger word is img:

A close-up photo of a scientist img receiving the Nobel Prize

Parameters

We recommend 20 to 30 steps with a guidance scale of 5.

As PhotoMaker uses SDXL, you can use prompt, negative prompt, number of steps and guidance scale as you would with Stable Diffusion. Read our Stable Diffusion guide for more tips.

Run PhotoMaker with an API

All models on Replicate come with a production-ready API. You can use our official Python, Node.js, Swift, Elixir and Go clients.

We'll use the Python client in this example, and run the prediction we showed above.

Get your API token

You’ll need to sign up for Replicate, then you can find your API token on your account page.

Run PhotoMaker with Python

Install Replicate’s Python client library:

pip install replicate

Set the REPLICATE_API_TOKEN environment variable:

export REPLICATE_API_TOKEN=r8-*********************************

Import the client and run the PhotoMaker model:

import replicate
 
output = replicate.run(
    "tencentarc/photomaker:latest",
    input={
        "prompt": "A close-up photo of a scientist img receiving the Nobel Prize",
        "num_steps": 30,
        "style_name": "Photographic (Default)",
        "input_image": "https://replicate.delivery/pbxt/KJJUD2bFRLjW3cbCZiPrbRI3sdNzKUS0ALG3bRFFhxFcecfU/lecun.jpg",
        "num_outputs": 1,
        "guidance_scale": 5,
        "style_strength_ratio": 20
    }
)
print(output)

Be adventurous with PhotoMaker

Not only can you use photographic inputs of people, but you can pass in paintings, photos of sculptures, 3D renders and more. You can bring historic figures to life, or see how video game characters might look in the real world.

If you ask for multiple people, or combine different people, you’ll get weird but interesting results.

Here is Isaac Newton beneath an apple tree:

Input
prompt
A photo of a man img sitting beneath an apple tree
Output

PhotoMaker and ComfyUI

You can use PhotoMaker with ComfyUI, and it’s supported in our run any ComfyUI workflow model.

If you’re familiar with ComfyUI, you can use the PhotoMaker nodes to combine the tool with other models, such as IPAdapters and LoRAs. You can also pick and choose from all the SDXL base weights available.

In this example we used the ComfyUI PhotoMaker workflow to turn photos of a Julius Caesar sculpture into a photo of a real person:

Input
workflow_json
[JSON code not shown]
Output