Image Fingerprint
Computes the fingerprint of a picture, to recognize copies of it whatever their size, format or metadata.#
/lmkit/v1/image-fingerprintDescribes what a picture looks like in a compact value that a copy keeps when it is resized, recompressed, converted to another format, turned to grayscale or stripped of its metadata, where a hash of the bytes changes entirely. Store the fingerprint beside the file, then compare two of them with lmkit/v1/image-fingerprint/similarity to find the duplicate pictures of a library. The picture is read as displayed: the orientation the file states is applied first. No AI model is involved and the same picture always produces the same fingerprint. A crop moves the content and is not recognized as the same picture. 'flat_share' tells a photograph from a page-like picture (a scan, a form, a chart, a screenshot), whose fine print a fingerprint does not hold. Use 'page_index' to pick a page of a multi-page TIFF. A payload that is not a decodable image is refused with 422 and error 'invalid_image'. 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 process. Default: 0. An index past the last page is refused with 400. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 202 | Accepted | |
| 400 | Bad Request | |
| 422 | Unprocessable Entity | |
| 500 | application/json | Internal Server Error |
curl -X POST "$LMKIT_ONE_URL/lmkit/v1/image-fingerprint" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "",
"input_format": "Base64EncodedFile",
"page_index": 0
}'Measures how alike two pictures are from their fingerprints.#
/lmkit/v1/image-fingerprint/similarityCompares two fingerprints returned by lmkit/v1/image-fingerprint and answers a similarity from 0 to 1: 1 for the same picture, 0 for unrelated pictures. It is the share of bits the two fingerprints agree on, rescaled so that the agreement two unrelated pictures reach by chance reads 0. Set 'any_orientation' to also recognize a copy turned by quarter turns or mirrored. Fingerprints of different versions are refused with 400.
Request body
application/json ·
| Property | Type | Description |
|---|---|---|
fingerprintrequired | string | A fingerprint returned by lmkit/v1/image-fingerprint. |
other_fingerprintrequired | string | The fingerprint to compare it with. Both must carry the same version. |
any_orientation | boolean | When true, the other picture is also tried turned by quarter turns and mirrored, and the best reading is returned: a scan saved sideways or a mirrored copy is recognized. Default: false. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 400 | Bad Request |
curl -X POST "$LMKIT_ONE_URL/lmkit/v1/image-fingerprint/similarity" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"fingerprint": "",
"other_fingerprint": "",
"any_orientation": false
}'