Plus plan

Portrait styles

Turn a portrait photo into a headshot or artistic portrait
POST
/v1/ai/generation/portrait

About this tool

This tool restyles a photo of a person while keeping them recognisable. You can make a professional headshot, a LinkedIn or passport-style photo, or an artwork such as oil painting or anime. You can also change the background, the outfit and how the photo is cropped. It uses AI (a computer program that creates images), so check that the face still looks right.
For example, you have a casual selfie and you want a neat business headshot with a plain background for your work profile.

How to use it

  1. Choose this tool.
  2. Add one portrait photo with Upload, or drag and drop it.
  3. Choose a Style, a Background and, if you like, an outfit.
  4. Choose how close to your face the result should be, and how to crop it.
  5. Press Generate, then download your portrait.

What you get back

You get a new portrait picture to download. You can ask for several versions and keep the one you like most.
TEST IT LIVE

Try Portrait styles in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
AI
Plan
Plus
Method
POST
Endpoint
/v1/ai/generation/portrait
Tool ID
ai.generation.portrait
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Ai
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/ai/generation/portrait" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'files=@document.pdf' \
  -F 'on_unsupported=error' \
  -F 'n=1' \
  -F 'output_format=png'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.ai.generation.portrait({
    "files": 'document.pdf',
    "on_unsupported": "error",
    "n": 1,
    "output_format": "png"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->ai()->generation()->portrait([
    'files' => 'document.pdf',
    'on_unsupported' => 'error',
    'n' => 1,
    'output_format' => 'png',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Restyle a portrait photo: professional headshot, LinkedIn, passport-style, studio, cinematic, painting, anime and more, keeping the person recognisable; background, outfit and framing are options. Readiness: unbenchmarked (see GET /v1/ai/capabilities/generation.portrait).

Classification: ai. Deterministic stages: upload content sniffing, input image normalisation (Sharp), generated image validation and re-encoding (Sharp), signed-URL output.

Portrait styles works from text and settings, so no file is needed. Every input is optional.

Not on the Free plan: Portrait styles is available on the Plus plan and above. Free accounts can upgrade any time to use it. Each run uses credits from your monthly allowance.

Send a POST request to /v1/ai/generation/portrait with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.