Image Analysis
Measures an image page: skew, blankness, bitonality, border color, and content bounds.#
/lmkit/v1/image-analysisReads the pixels of one page and answers with numbers, never image bytes: 'skew_angle' (the tilt of the text lines, positive when the page leans clockwise as displayed), 'blank' (every pixel one color within 'blank_tolerance'), 'bitonal' (pure black and white already), 'border_color' (the uniform color along the border when at least 'border_min_share' of it agrees) and 'content_bounds' (the region auto-crop would keep under 'crop_margin' and 'crop_tolerance'). Use it to skip empty scans, decide whether a page needs deskew or binarization, or preview a crop before paying for the transform. lmkit/v1/file-info reads the container's metadata; this route reads the pixels. Use 'page_index' to pick a page of a multi-page TIFF. 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 ·
| Property | Type | Description |
|---|---|---|
inputrequired | string | 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_index | object (int32) | Zero-based page of a multi-page image (a TIFF scan) to measure. Default: 0. An index past the last page is refused with 400. |
max_angle | object (float) | Skew: largest tilt searched, in degrees (2-45). Default: 15. |
blank_tolerance | object (int32) | Blank: per-channel distance (0-255) a pixel may sit from the first pixel and still count as the same color. 0 (default) requires exact uniformity; raise it for noisy scans of empty pages. |
border_min_share | object (float) | Border color: the share (0-1) of the border pixels that must agree on one color for it to be reported. Default: 0.85. |
crop_margin | object (int32) | Content bounds: pixels of border kept around the detected content. Default: 0. |
crop_tolerance | object (int32) | Content bounds: per-channel distance (0-255) a border pixel may sit from the corner color and still count as border. 0 (default) matches exactly; raise it for noisy scans. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 202 | Accepted | |
| 400 | Bad Request | |
| 500 | application/json | Internal Server Error |
curl -X POST "$LMKIT_ONE_URL/lmkit/v1/image-analysis" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "",
"input_format": "Base64EncodedFile",
"page_index": 0,
"max_angle": 15,
"blank_tolerance": 0
}'