Portrait3D™ API takes an image as input and generates a photorealistic 3D avatar that can move and express emotions. 3D avatar can be published on a Web-page (requires Adobe® Flash® Player).

Portrait3D may be useful for various social applications, games and chat rooms to bring in power and features of 3D while maintaining photorealistic quality.

API Description

Source Image Restrictions

Portrait3D has some restrictions on source images:

  • Image Type: JPEG or PNG
  • Image Dimensions: 200×200 up to 4000×4000
  • Image File Size: 10 KBytes up to 5 MBytes

Images that don’t fit these requirements are rejected with HTTP Status Code 400.

Source Image Recommendations

To get best looking avatar, follow these simple recommendations:

  • Image should contain only one face
  • Best results are achieved on full face images with minimum rotation around the vertical axis
  • Image resolution should be high enough to produce high-quality avatar

In general: quality of the source photograph affects quality of the resulting avatar.

Passing Image URL

If your image is hosted somewhere, you may use the URL to create an avatar. URL should be passed in the 'url' parameter using GET method:

https://avatarion-portrait3d.p.mashape.com/create/?url={URL}

Note: {URL} string should be url-encoded.

Example (using cURL):

curl -H "X-Mashape-Authorization: {Your Mashape Authorization Code}" "https://avatarion-portrait3d.p.mashape.com/create/?url=http%3A%2F%2Favatarion.com%2Fimages%2Fharrison-ford.jpg" -k

POSTing Image File

Another option is to upload an image using POST request and the 'image' parameter. Example (using cURL):

curl -H "X-Mashape-Authorization: {Your Mashape Authorization Code}" "https://avatarion-portrait3d.p.mashape.com/create/" -F "image=@test.jpg;" -k

In this example 'test.jpg' is the actual image file to be uploaded.

API Response

Regardless of the chosen method, if no errors occur the API sets HTTP Status Code to 200 and returns JSON object in the response body:

{ "avatar" : "abc123" }

'abc123' is the Avatar ID that can be used to publish an avatar on a desired Web page (see below).

Error Handling

If something goes wrong the API sets HTTP Status Code to one of the following values:

  • 400 – indicates a problem with the provided image (wrong file type, size, URL does not exist, etc.)
  • 500 – indicates an internal API error. If this error persists please contact us.

Additionally, error details are passed in the response body in JSON format:

{ "error" : "INVALID_IMAGE_FILE_SIZE" }

Using Created Avatars

Created avatars can be published on a Web page using the following HTML code:

<iframe width="250" height="250" frameborder="0" src="http://content.avatarion.com/portrait3d/v1/embed/{AvatarID}?emotion={Emotion}"></iframe>

{AvatarID} is an ID of an avatar returned by the API.

The 'emotion' parameter sets the primary emotion, expressed by the avatar (optional). Currently we support the following emotions: neutral, smile, wink, sad and surprise.

Additionally you may change 'width' and 'height' attributes of the iframe tag.

Note: you can also use a secure connection for sites that work over SSL, just replace 'http' with 'https' in the <iframe> src attribute.

Example:

<iframe width="250" height="250" frameborder="0" src="http://content.avatarion.com/portrait3d/v1/embed/83kw36?emotion=wink"></iframe>

Or (if your site requires SSL):

<iframe width="250" height="250" frameborder="0" src="https://content.avatarion.com/portrait3d/v1/embed/83kw36?emotion=wink"></iframe>

Last 7 days, UTC

Average Latency
204ms

Average Uptime
100.0%

Current Status
Online

  • No information
  • Outage
  • Disruption
  • Normal
Average latency determined from Mashape to API Response time

Simple & Straightforward Pricing

Pay as you go. No long-term contracts.

Freemium

$0

additional fees may apply

Avatars

10 / mo.

$0.1000 per extra

Subscribe

basic

$35.00

per month

Avatars

500 / mo.

$0.0850 per extra

Subscribe

ultra

$1500.00

per month

Avatars

100,000 / mo.

$0.0150 per extra

Subscribe

Create Avatar

HTTP 200 : Create Avatar Response POST/create/
Describes API response if image processing was successful
						{
  "avatar": "83kw36"
}						
Create Avatar From POST File

Test console
Description
Parameter
binary

Source image data. Supported image types are JPEG and PNG, 200x200 up to 4000x4000 pixels, 10 KB up to 5 MB size.

image

Required

  • string – Indicates a problem with the provided image (wrong file type, dimensions, size, etc.)

    HTTP 400
  • string – Indicates internal API error. If this error persists please contact us.

    HTTP 500
HTTP 200 : Create Avatar Response GET/create/
Describes API response if image processing was successful
						{
  "avatar": "83kw36"
}						
Create Avatar From URL

Test console
Description
Parameter
string

Source image URL. Supported image types are JPEG and PNG, 200x200 up to 4000x4000 pixels, 10 KB up to 5 MB size.
Example: http://avatarion.com/images/harrison-ford.jpg

url

Required

  • string – Indicates a problem with the provided image (wrong file type, size, dimensions, URL does not exist)

    HTTP 400
  • string – Indicates internal API error. If this error persists please contact us.

    HTTP 500

You must have an API key to test this API!


Mashape allows developers to find, consume, and distribute cloud APIs just like Portrait3D.

Login to your account or signup: Create Account

or
   Signup with GitHub

By signing up you agree to our terms of service.