Photo Animer
Using artificial intelligence technology to make the input photos live according to the style, expression-driven static images may take a long time and require asynchronous methods to obtain the results, so we provide three interfaces to complete this process.
API documentation
Interface 1: Submit static image to generate moving video task
- Request URL: https://www.cutout.pro/api/v1/faceDriven/submitTaskByUrl?imageUrl=xxxx&templateId=1
- Request method: GET
- Return type: json data
- Input parameters:
(1)Request parameters (Header)
Parameter | Parameter Type | Description |
---|---|---|
APIKEY | string | Your API Key |
(2) Query String
Parameter | Parameter Type | Description |
---|---|---|
imageUrl | url | The URL of the static image of the face |
voiceUrl | url | audio file url.Template ID must be 0 |
outputFormat | string | output format, avaiable values: gif. By default, a mp4 video is generated, if outputFormat is set to "gif", additional "gifUrl" field will be provided in response. |
templateId | 0, 1, 2, 3, 4, 5 can be chosen | Expression template index number, starting from 0, currently supports 0,1,2,3,4,5 six kinds of expressions |
(3) Response data
{
"code": 0,
"data": 123456, //Return the task ID after the task is submitted
"msg": null,
"time": 1615368038661
}
Sample Code
curl -H 'APIKEY: INSERT_YOUR_API_KEY_HERE' \
'https://www.cutout.pro/api/v1/faceDriven/submitTaskByUrl?imageUrl=xxxx&templateId=1'
import requests
response = requests.get(
'https://www.cutout.pro/api/v1/faceDriven/submitTaskByUrl?imageUrl=xxxx&templateId=1',
headers={'APIKEY': 'INSERT_YOUR_API_KEY_HERE'},
)
$client = new GuzzleHttp\Client();
$res = $client->get('https://www.cutout.pro/api/v1/faceDriven/submitTaskByUrl?imageUrl=xxxx&templateId=1', [
'headers' => [
'APIKEY' => 'INSERT_YOUR_API_KEY_HERE'
]
]);
File file = new File("/Your/Image/File/Path");
CloseableHttpClient client = HttpClients.createDefault();
HttpGet httpGet = new HttpGet("https://www.cutout.pro/api/v1/faceDriven/submitTaskByUrl?imageUrl=xxxx&templateId=1");
httpGet.setHeader("APIKEY", "INSERT_YOUR_API_KEY_HERE");
try (CloseableHttpResponse response = client.execute(httpGet)){
if (response.getStatusLine().getStatusCode() == HttpStatusCode.OK) {
//todo your logic
}
} catch (IOException e) {
e.printStackTrace();
}
var request = require('request');
var fs = require('fs');
request.get({
url: 'https://www.cutout.pro/api/v1/faceDriven/submitTaskByUrl?imageUrl=xxxx&templateId=1',
headers: {
'APIKEY': 'INSERT_YOUR_API_KEY_HERE'
},
encoding: null
}, function(error, response, body) {
// console.log(response);
});
Interface 2: Asynchronous notification
- You need to provide an api address for receiving asynchronous notifications. The notification will be posted to the specified address in json format, json example:
{
"eventName":"EVENT_FACE_DRIVEN_TASK_FINISHED",
"eventData": {
"taskId":123456,
"resultUrl": "http://xxxxxxxxxxx", //Video address after video processing is completed
}
}
Interface 3: Actively queried interface
- Request URL: https://www.cutout.pro/api/v1/faceDriven/getTaskInfo?taskId=123456
- Request method: GET
- Input parameters:
(1) Request parameters (Header)
Parameter | Parameter Type | Description |
---|---|---|
APIKEY | string | Your API key |
(2) Query String
Parameter | Parameter Type | Description |
---|---|---|
taskId | task ID | true |
(3) Response data
{
"code": 0,
"data": {
"taskId": 123456,
"status": 1, //0: processing, 1: finished, 2: failed (it can be failed when there is no person detected)
"resultUrl": "http://xxxxxxxxxxx.mp4", //Video address after video processing is completed
"gifUrl": "http://xxxxxxxxxxx.gif" // If outputFormat is set to "gif", additional "gifUrl" field will be provided in response
},
"msg": null,
"time": 1615368038661
}
Price
This interface call needs to consume video seconds. The video seconds corresponding to different templates are as follows:
Template id | Seconds |
---|---|
0 | 3.13s |
1 | 7.13s |
2 | 2.13s |
3 | 6.75s |
4 | 4.38s |
5 | 3.75s |
Frequently asked questions
- Q: What are the requirements for the input image format?
- A: Support PNG, JPG, JPEG, BMP, WEBP
- Q: Is there a limit to the supported image size?
- A: The maximum resolution uploaded at present is 4096x4096 pixels, and the image file size is less than 15MB