Plus plan

AI style transfer

Redraw a picture in a different art style
POST
/v1/ai/generation/style

About this tool

This tool repaints your picture in another style, such as watercolour, pencil sketch or anime. You can describe the style in words or add a second picture to copy its look. You choose how strong the change is and what to keep: the shapes, the colours or the subject. It uses AI (a computer program that creates images), so results can vary.
For example, you have a portrait photo and you want it to look like a soft watercolour painting.

How to use it

  1. Choose this tool.
  2. Add the picture to restyle with Upload. Optionally add a second picture whose style you like.
  3. Describe the style in words, or leave it to the second picture.
  4. Choose how strong the change is and what to keep.
  5. Press Generate, then download the result.

What you get back

You get a new picture in the new style that you can download. Make more versions to see different looks.
TEST IT LIVE

Try AI style transfer 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/style
Tool ID
ai.generation.style
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/style" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'files=@document.pdf' \
  -F 'on_unsupported=error' \
  -F 'strength=low' \
  -F 'preserve=structure'

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.style({
    "files": 'document.pdf',
    "on_unsupported": "error",
    "strength": "low",
    "preserve": "structure"
  });
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()->style([
    'files' => 'document.pdf',
    'on_unsupported' => 'error',
    'strength' => 'low',
    'preserve' => 'structure',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Restyle a picture after a second picture, or after a description, with a strength and a choice of what to keep (structure, colours or subject). Readiness: unbenchmarked (see GET /v1/ai/capabilities/generation.style).

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

AI style transfer works from text and settings, so no file is needed. Every input is optional.

Not on the Free plan: AI style transfer 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/style 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.