Image Retouch

Get API Key

Remove unwanted area and fill the hole with content that is consistent with the remaining regions of the image. Remove any undesired elements including passers-by, clutter, trash cans, power lines, skin blemishes, scratches, text, etc.

Image Retouch API Call Sample Code

  import requests

  requestBody = {
     {
      "base64": "/9j/4AAQSkZJRgABAQEA...",
        "rectangles": [
          {
            "height": 100,
            "width": 100,
            "x": 160,
            "y": 280
          }
        ]
      }
  }
  response = requests.post(
      'https://www.cutout.pro/api/v1/imageFix', 
      data=json.dumps(requestBody),
      headers={'APIKEY': 'INSERT_YOUR_API_KEY_HERE','Content-Type': 'application/json'},
  )
  $host = "https://www.cutout.pro";
  $path = "/api/v1/imageFix";
  $method = "POST";
  $APIKEY = "YOUR_API_KEY_HERE";
  $headers = array();
  array_push($headers, "APIKEY:".APIKEY);
  //Define the corresponding Content-Type according to the requirements of the API
  array_push($headers, "Content-Type".":"."application/json; charset=UTF-8");
  $querys = "";
  $requestBody = array(
    "base64"=>"/9j/4AAQSkZJRgABAQEA...",
    "rectangles"=>[
      [
        "height"=>100,
        "width"=>100,
        "x"=>160,
        "y"=>280
      ]
    ]
  )

  $bodyStr = json_encode($requestBody);
  $url = $host . $path;
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
  curl_setopt($curl , CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($curl , CURLOPT_POST, 1);

  curl_setopt($curl, CURLOPT_POSTFIELDS, $bodyStr);

  $res = curl_exec($curl);
  var_dump($res);
  @Autowired
  private RestTemplate restTemplate;

  //Construct request json
  String base64 = "/9j/4AAQSkZJRgAB...";
  HashMap<String,Object> jsonObject = new LinkedHashMap<>();
  jsonObject.put("base64",base64);
  List<HashMap<String,Object>> rectangles = new ArrayList<>();
  HashMap<String,Object> rectangle = new HashMap<>();
  rectangle.put("x",160);
  rectangle.put("y",250);
  rectangle.put("width",100);
  rectangle.put("height",100);
  rectangles.add(rectangle);
  jsonObject.put("rectangles",rectangles);

  //Set request header
  HttpHeaders headers = new HttpHeaders();
  headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
  headers.set("APIKEY", "YOUR_API_KEY_HERE");
  HttpEntity<String> request = null;
  try {
      String requestBody = objectMapper.writeValueAsString(jsonObject);
      request = new HttpEntity(requestBody , headers);
  } catch (JsonProcessingException e) {
      e.printStackTrace();
  }

  String api = "https://www.cutout.pro/api/v1/imageFix";
  long startTime = System.currentTimeMillis();

  HashMap result = restTemplate.postForObject(api , request, HashMap.class);

  //todo: your logic to deal with result

API documentation

Request description

Input parameters:

(1) Request parameters (Header)

ParameterParameter TypeDescription
Content-Typestringapplication/json
APIKEYstringYour API Key

Get API Key

(2) Request parameters (Body)

    {
      "base64": "/9j/4AAQSkZJRgABAQEA...", //Convert image file to base64 string
      "rectangles": [ //Rectangular mask area, support multiple arrays
        {
          "height": 100,
          "width": 100,
          "x": 160,
          "y": 280
        },
        {
          "height": 100,
          "width": 100,
          "x": 560,
          "y": 680
        },
      ],
      //User-provided mask image file converted to base64 string, compatible with single-channel, three-channel, and four-channel black and white images. The area to be repaired is in white and the areas to be untouched are in black. If this entry is provided, the “rectangles” parameter is ignored. 
      "maskBase64": "/9j/4AAQSkZJRgABAQEA..." 
    }

Examples of input picture and mask picture:

input picture:

avatar

mask picture:

avatar

Response description

  • Return parameter Return json format data
{
    "code": 0,
    "data": {
        "status": "success",
        "imageUrl": "https://deeplor.s3.us-west-2.amazonaws.com/imagefix_preview/2021/04/29/a7e2cdd05e614d99a2d569430f4eeccc.jpg" //Result of image retouch url connection
    },
    "msg": null,
    "time": 1595910561072
}

Price

Purchase API calls online.

Review pricing plans

  • Note: Each successful photo retouch API call costs 1 credit.

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