API: Center crop

Crops the center of an image. An online tool is available for this API call.

Request
POST /process/crop-center?aspectRatio=2:1&cropSize=1&input=0a6677...
input The input image ID.
aspectRatio The aspect ratio of the picture, written as a width:height (e.g. 16:10), or as width-height ratio (e.g. 1.6).
cropSize The crop size with respect to the maximum possible crop, written as percentage (e.g. 80%), or as ratio (e.g. 0.8).
expansion

How the image shall be expanded for crop sizes above 100%. Two types of expansion are available:

  • Color expansion, written as rgb(R,G,B), where R, G, and B are values between 0 and 255. The area outside of the original image is filled with thisi color.
  • Soft expansion, written as soft(SLOPE), where SLOPE is a value between 0.2 and 0.6. The image border is expanded to fill the desired area. Larger SLOPE values use a larger border and result in a more graceful expansion.
outputFormat The desired output format. Valid formats are PNG and JPEG.
outputQuality The desired JPEG compression quality, an integer between 50 and 100. The default value is 95 (high quality). Values below 85 may lead to visible compression artefacts.
Response
200 OK
{
  "crop": [80, 140, 640, 320],
  "output": "a1b002.."
}
crop The applied crop rectangle (x, y, width, height).
output The produced image.
outputFormat
The format of the output image:
  • extension: The format extension, e.g. "png".
  • mimeType: The media type of the format, e.g. "image/png".
  • quality: The JPEG compression quality (JPEG pictures only).