One way to improve the quality of a face photo is making a standardized face crop. To do so, use the operation icao_crop, which uses the rules imposed by ICAO to crop a face photo, considering the position of the eyes and face geometry, to improve the results of the system’s automatic biometric analysis.

For the request body, insert the base64 string of the image you wish to crop, as in the example below:

{
  "Check": {
    "Image": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCE..."
  }
}

In the header, insert the content type and your subscription key, replacing <API-KEY>, as shown in the following example:

{
  'Content-Type': 'application/json',
  'Ocp-Apim-Subscription-Key': '<API-KEY>'
}

Lastly, to perform the request, specify it’s a POST method, the https://api.biopassid.com/quality/icao_crop URL, the header, and the body. Below there is an example of how a request of this kind would look like, written in Python, but that can be seen in several other programming languages in our documentation:

import http.client
import json

conn = http.client.HTTPSConnection("hml-api.biopassid.com")
payload = json.dumps({
  "Check": {
    "Image": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCE..."
  }
})
headers = {
  'Content-Type': 'application/json',
  'Ocp-Apim-Subscription-Key': '<API-KEY>'
}
conn.request("POST", "/quality/icao_crop", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

The request response, in case no error is found, will be an IcaoCropedImage object, with the base64 string of the image already cropped. The response for the request made above can be seen in the following example:

{
  "IcaoCropedImage": {
    "Image": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCE..."
  }
}