Cropper
What is Cropper?
Cropper enables users to retrieve the coordinates of cropped images from a document through our APIs.
Cropper can be used in two ways:
On any API by adding a parameter.
By using the stand-alone API Cropper.

How it Works
The cropper feature can be used on any API on the prediction route:
?cropper=true is the additional parameter to add to your API calls.
Cropper Output
The cropper results are located at the page-level when retrieving document prediction. The cropper results are returned in the following JSON object document.inference.pages[].extras.cropper.cropping[].xxxxxx. Most of the time, taking the first element of the cropper output is sufficient for most use case.
The results show the polygon vertices at the page level, for each possible cropped document within the image:
bounding_box: straight rectangle (always inside canvas).
rectangle: rectangle that may be oriented (can go beyond the canvas, i.e. vertices coordinate < 0 and > 1).
quadrangle: free polygon with 4 vertices (always inside canvas).
polygon: free polygon with up to 30 vertices (always inside canvas).
The vertices format are a list of (x, y) relative coordinates to your document, always in clockwise order. Starting vertex may not be fixed (depends if this is a rectangle or a free polygon).
Example:
Example With Receipts V5
Using this sample receipt document we append the cropper additional param ?cropper=true to the receipts API URL.
Our result shows the different polygon vertices (bounding_box, rectangle, quadrangle, polygon) at the page level.
Replace my-api-key-here with your new API key, or use the select an API key feature and it will be filled automatically.
Copy and paste the sample code of your desired choice in your application, code environment, terminal etc.
Replace
/path/to/the/file.extwith the path to your input document.
Remember to replace with your V1 API key.
Cropper standalone API
Setup the API
Access your Cropper API by clicking on the Cropper card in the Utilities tab:

From the left navigation, go to documentation > API Reference, you'll find sample code in popular languages and command line.
Replace my-api-key-here with your new API key, or use the select an API key feature and it will be filled automatically.
Copy and paste the sample code of your desired choice in your application, code environment, terminal etc.
Replace
/path/to/the/file.extwith the path to your input document.
Remember to replace with your V1 API key.
API Response
Here is the full JSON response you get when you call the API:
Last updated
Was this helpful?

