Image Operations

Warp (perspective correct) an image

Creates a task to apply perspective correction (warp) to an image based on detected document boundaries.

POST
/v1/image-operations/warp

Authorization

x-api-key
<token>

API Key for authentication

In: header

Request Body

application/jsonOptional
inputrequired
string

The id of the file to operate on.

name
string
verticesrequired
array<unknown>

Coordinates of the 4 vertices of the quadrilateral to warp the image to.

@minItems 4 @maxItems 4

Response Body

The response of an warp task

TypeScript Definitions

Use the response body type in TypeScript.

responserequired
Warp Response

The response of an warp task

curl -X POST "https://api.scan-documents.com/v1/image-operations/warp" \
  -H "x-api-key: <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "file_avyrvozb9302uwhq",
    "name": "Example Image",
    "vertices": [
      {
        "x": 0,
        "y": 0
      },
      {
        "x": 100,
        "y": 10
      },
      {
        "x": 100,
        "y": 100
      },
      {
        "x": 0,
        "y": 90
      }
    ]
  }'
{
  "id": "task_euyrvozb9302uwhq",
  "operation": "warp",
  "parameters": {
    "input": "file_avyrvozb9302uwhq",
    "name": "Example Image",
    "vertices": [
      {
        "x": 0,
        "y": 0
      },
      {
        "x": 100,
        "y": 10
      },
      {
        "x": 100,
        "y": 100
      },
      {
        "x": 0,
        "y": 90
      }
    ]
  },
  "status": "completed",
  "result": {
    "generated_files": [
      {
        "id": "file_euyrvozb9302uwhq",
        "name": "Example Image",
        "type": "image/png",
        "properties": {
          "size": 1024,
          "width": 800,
          "height": 600
        },
        "task_id": "task_euyrvozb9302uwhq",
        "created_at": "2021-05-01T12:00:00Z"
      }
    ]
  },
  "created_at": "2021-05-01T12:00:00Z",
  "updated_at": "2021-05-01T12:00:00Z"
}