Models / Type Detection

Type Detection


The image properties API can help you determine if an image is an illustration or a photography. An illustration could be a drawing, a clipart, a painting, a logo or any such image that does not look like a natural photo.

Illustration (logo)
Illustration (drawing)
Illustration (clipart)
Illustration (painting)
Natural photo

Type detection

The property detection does not use any image meta-data to determine the type of an image. The file extension, the meta-data or the name will not influence the result. The classification is made using only the pixel content of the image.


  • Require that users submit or upload real photos only, and not non-photographic content.
  • Group or classify your images depending on their type


  • Depending on the way they have been taken, photos of paintings / drawings may be detected as paintings or drawings and not as photos.
  • Some realistic illustrations (such as computer-generated scenes or realistic paintings) may be classified as photos.


The returned value is between 0 and 1, images with an illustration value closer to 1 will be an illustration while images with an illustration value closer to 0 will be a photography.

Illustration: (illustration value 0.80677)


The returned value is between 0 and 1, images with a photo value closer to 1 will be a photography while images with a photo value closer to 0 will be an illustration.

photography: (photo value 0.950306)

Use the model

If you haven't already, create an account to get your own API keys.

Detect the type of an image

Let's say you want to moderate the following image:

You can either upload a public URL to the image, or upload the raw binary image. Here's how to proceed if you choose to share the image's public URL:

curl -X GET -G '' \
    -d 'models=type' \
    -d 'api_user={api_user}&api_secret={api_secret}' \
    --data-urlencode 'url='

# this example uses requests
import requests
import json

params = {
  'url': '',
  'models': 'type',
  'api_user': '{api_user}',
  'api_secret': '{api_secret}'
r = requests.get('', params=params)

output = json.loads(r.text)

$params = array(
  'url' =>  '',
  'models' => 'type',
  'api_user' => '{api_user}',
  'api_secret' => '{api_secret}',

// this example uses cURL
$ch = curl_init(''.http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

$output = json_decode($response, true);

// this example uses axios
const axios = require('axios');

axios.get('', {
  params: {
    'url': '',
    'models': 'type',
    'api_user': '{api_user}',
    'api_secret': '{api_secret}',
.then(function (response) {
  // on success: handle response
.catch(function (error) {
  // handle error
  if (error.response) console.log(;
  else console.log(error.message);

The API will then return a JSON response:

  "status": "success",
  "request": {
    "id": "req_VjyxevVQYXQZ1HMbnwtn",
    "timestamp": 1471762434.0244,
    "operations": 1
  "type": {
    "illustration": 0.000757,
    "photo": 0.999243
  "media": {
    "id": "med_KWmB2GQZ29N4MVpVdq5K",
    "uri": ""

Any other needs?

See our full list of Image/Video models for details on other filters and checks you can run on your images and videos. You might also want to check our Text models to moderate text-based content: messages, reviews, comments, usernames...

Was this page helpful?