LM-Kit OneDocs2026.9.7lm-kit.comEULA
Image Utilities

Image Deskew

Straightens a tilted scan by measuring and correcting its skew.#

POST/lmkit/v1/image-deskew

Measures the tilt of the text lines within 'max_angle' degrees and rotates the page by the opposite angle. The response always carries an image: the straightened page when the measured tilt reached 'min_angle' ('corrected' true), otherwise the untouched page ('corrected' false), and 'skew_angle' reports the measurement in both cases, positive when the source leaned clockwise as displayed. Use 'page_index' to pick a page of a multi-page TIFF. The result is returned base64-encoded in 'output_format'. No AI model is involved: the pass is pure image processing and runs on any server. If processing exceeds the configured timeout, returns 202 Accepted with a job_id. Poll GET /lmkit/v1/jobs/ for status and results.

Request body

application/json ·

PropertyTypeDescription
inputrequiredstring

The input image. When input_format is 'Base64EncodedFile', provide a base64-encoded image payload. When 'FileIdentifier', provide the file ID previously returned by the lmkit/v1/files/upload endpoint.

input_format

How the input is provided. Accepted values: 'Base64EncodedFile' or 'FileIdentifier'. Defaults to 'Base64EncodedFile'.

page_indexobject (int32)

Zero-based page of a multi-page image (a TIFF scan) to process. Default: 0. An index past the last page is refused with 400.

max_angleobject (float)

Largest tilt searched, in degrees (2-45). A wider window finds a badly skewed page at the cost of a longer search. Default: 15.

min_angleobject (float)

Smallest tilt worth correcting, in degrees. Below it the page is considered straight and returned untouched with 'corrected' false. Default: 0.5.

interpolateboolean

Resample with bilinear interpolation (default, smooth edges) or nearest-neighbor (faster, keeps a bitonal scan bitonal).

output_format

Encoding of the returned image. 'png' (default, lossless) and 'webp' (lossy) keep any alpha channel; 'jpeg' cannot hold transparency and is flattened over opaque white; 'tiff' is lossless.

output_qualityobject (int32)

Quality (1-100) for the lossy encodings ('webp', 'jpeg'); ignored for 'png' and 'tiff'. Default: 80.

Responses

StatusTypeDescription
200

OK

202

Accepted

400

Bad Request

500application/json

Internal Server Error

curl -X POST "$LMKIT_ONE_URL/lmkit/v1/image-deskew" \
  -H "Authorization: Bearer $LMKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": "",
  "input_format": "Base64EncodedFile",
  "page_index": 0,
  "max_angle": 15,
  "min_angle": 0.5
}'