Passport Photo

Create your own professional passport photo online with single-click in one second. Remove background automatically, replace with white background. Auto resize and crop portrait, and convert to perfect size with face centered. Offer official photo sizes for ID, Passport, VISA and License of various countries including USA, Spain, Germany, France, India, China, Italy, Korea and Brazil: 2’’x2’’, 3’’x4’’, 4’’x4’’, 4’’x6’’, 5’’x6’’, etc.

Passport Photo API Call Smaple Code

$host = "https://www.cutout.pro";
  $path = "/api/v1/idphoto/printLayout";
  $method = "POST";
  $apikey = "your own apikey";
  $headers = array();
  array_push($headers, "APIKEY:" . $apikey);
  array_push($headers, "Content-Type:application/json; charset=UTF-8");
  $querys = "idcard=210000&realname=%E5%BC%A0%E4%B8%89";

  $data = array(
    "base64"=> "/9j/4AAQSkZJRgA...Note: some people use the online base64 conversion tool when testing, and pay attention to removing 'data:image/jpg;base64', this part of the string",
    "bgColor"=>"FFFFFF",
    "dpi"=>300,
    "mmHeight"=>35,
    "mmWidth"=>25,
    "printBgColor"=>"FFFFFF",
    "printMmHeight"=>210,
    "printMmWidth"=>150
  )
  $bodys = json_encode($data);
  $url = $host . $path;
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
  curl_setopt($curl, CURLOPT_FAILONERROR, false);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_HEADER, true);
  if (1 == strpos("$".$host, "https://"))
  {
      curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  }
  curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys);
  var_dump(curl_exec($curl));
import requests

url = 'https://www.cutout.pro/api/v1/idphoto/printLayout'
apikey = 'your own apikey'
headers={'APIKEY': apikey, "Content-type": "application/json"}
data = {
"base64": "/9j/4AAQSkZJRgA...Note: some people use the online base64 conversion tool when testing, and pay attention to removing 'data:image/jpg;base64', this part of the string",
"bgColor": "FFFFFF",
"dpi": 300,
"mmHeight": 35,
"mmWidth": 25,
"printBgColor": "FFFFFF",
"printMmHeight": 210,
"printMmWidth": 150
}
response=requests.post(url=url,headers=headers,json=data)
print(response.content)
  RestTemplate restTemplate = new RestTemplate();
  String url = "https://www.cutout.pro/api/v1/idphoto/printLayout";
  HashMap<String,Object> data = new LinkedHashMap<>();

  byte[] bytes = FileUtils.readFileToByteArray(new File("D:/picup/4.jpg"));
  byte[] base64Bytes = Base64.getEncoder().encode(bytes);
  String base64Str = new String(base64Bytes);


  data.put("base64",base64Str);
  data.put("bgColor","FFFFFF");
  data.put("dpi","300");
  data.put("mmHeight","35");
  data.put("mmWidth","25");
  data.put("printBgColor","FFFFFF");
  data.put("printMmHeight","210");
  data.put("printMmWidth","150");
  HttpHeaders headers = new HttpHeaders();
  headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
  headers.add("APIKEY","your own apikey");
  HttpEntity<String> request = new HttpEntity<>(JSON.toJSONString(data), headers);
  ResponseEntity<String> postForEntity = restTemplate.postForEntity(url,request,String.class);
  System.out.println(postForEntity.getBody());

API documentation

Request description

(1) Request parameters (Header)

parameterparameter typeDescription
Content-Typestringapplication/json
APIKEYstringYour API Key

(2) Request parameter (Body)

{
  base64 (string, required): Base64 of the image file,
  bgColor (string, required): The background color of the passport photo, the format is hexadecimal RGB, such as:3557FF ,
  bgColor2 (string, optional): The gradient background color of the passport photo (if applicable), the format is hexadecimal RGB, such as: 3557FF, if gradient color is needed, fill in this entry, the background color gradient will be vertical from top to bottom, bgColor will gradually change to bgColor2,
  dpi (integer, required): passport photo printing dpi, generally 300,
  mmHeight (integer, required): The physical height of the passport photo, in millimeters,
  mmWidth (integer, required): The physical width of the passport photo, in millimeters,
  printBgColor (string, required): Background color of the passport layout (print sheet), the format is hexadecimal RGB, such as: FFFCF9 ,
  printMmHeight (integer, required): The size of the print layout, in millimeters, if it is 0 or smaller than the size of the passport photo, a single passport photo will be returned, otherwise, multiple passport photos will be laid out on one sheet accordingly, 
  printMmWidth (integer, required): The size of the print layout, in millimeters, if it is 0 or smaller than the size of the passport photo, a single passport photo will be returned, otherwise, multiple passport photos will be laid out on one sheet accordingly,
  dress(string, optional): The outfit parameter is in the format of gender + outfit number. For example, man1 is the first outfit picture for men, woman3 is the third outfit for women, and child5 is the fifth outfit for children.
         *An extra point will be deducted if this parameter is specified.
}

Outfit/suit change sample pictures:https://cutout.s3.amazonaws.com/site/en/idphoto-dress.zip

(3) Response data

{
  "code": 0,
  "data": {
    "idPhotoImage": The URL of the single passport photo, it expires in ten minutes,
    "printLayoutImage": The URL for the layout of the passport photos, it expires in ten minutes, if the layout is not specified or the layout size is smaller than the passport photo size, the URL is the same as that of the passport photo,
    "idPhotoCount": The number of passport photos on the layout, if layout is not specified or the layout size is smaller than the passport photo size, it returns 0
  },
  "msg": null,
  "time": 1599644436677
}

Price

Purchase API calls online.

Review pricing plans

Note: Each successful API call costs 1 credit is for the passport photo (without outfit change); Passport photo & outfit/suit change, a total of 2 credits will be deducted.

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
  • Q: Request QPS limit?
  • A: Supports 5 simultaneous requests per second