Image Redaction
Permanently removes content from an image (redaction).#
/lmkit/v1/image-redactPaints opaque boxes over the regions to remove, re-encodes the pixels so the covered content cannot be recovered from the file, and strips the metadata (EXIF, XMP, embedded thumbnails) that could carry it. Specify what to remove with 'search_terms' (every occurrence located on the page by OCR is painted over; needs the server's OCR engine, otherwise 503 with error 'ocr_unavailable') and/or 'areas' (explicit pixel regions, per page of a multi-page TIFF). The redacted image is returned base64-encoded in the source encoding by default, so a multi-page TIFF stays one file; set 'output_format' to transcode a single-page result. With 'delivery': 'file' the image is stored on the server instead and the response carries its 'file_id' (and no 'data'). The report counts the matches and areas painted. Explicit areas involve no AI model; search terms read the pixels through OCR. 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'. | |
search_terms | string[] | Strings to locate on the page by OCR; every occurrence is painted over. Requires an OCR engine on the server (503 with error 'ocr_unavailable' otherwise). May be empty when 'areas' is given. |
areas | [] | Explicit regions to paint over, in image pixels with the origin at the top-left of their page. Use them for a signature, a face, or any region regardless of its content. May be empty when 'search_terms' is given. |
case_sensitive | boolean | Whether 'search_terms' match case. Default: false. |
whole_word | boolean | Whether 'search_terms' match only at word boundaries. Default: false. |
fill_color | string | Color of the painted boxes as '#RRGGBB'. Default: '#000000'. |
strip_metadata | boolean | Drops EXIF, XMP and every other metadata block from the output, so nothing about the original (camera, location, thumbnails) survives beside the redacted pixels. Default: true. |
apply_orientation | boolean | Honors the image's EXIF orientation: 'areas' are read in the image as displayed (the orientation applied, as every viewer shows it), and with 'strip_metadata' the output pixels are stored upright, so dropping the orientation tag never turns the picture sideways. False reads 'areas' in the stored pixels. Default: true. |
output_format | one of object · | |
output_quality | object (int32) | Quality (1-100) for the lossy encodings when 'output_format' is 'webp' or 'jpeg'. Default: 80. |
delivery | How the redacted bytes are delivered: 'inline' (default) as base64 in 'data', or 'file' as a stored file whose 'file_id' the response returns (read it with GET lmkit/v1/files/, delete it with DELETE lmkit/v1/files/) - the choice for large images or a caller that streams the result. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 202 | Accepted | |
| 400 | Bad Request | |
| 503 | Service Unavailable | |
| 500 | application/json | Internal Server Error |
curl -X POST "$LMKIT_ONE_URL/lmkit/v1/image-redact" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "",
"input_format": "Base64EncodedFile",
"search_terms": [
"string"
],
"areas": [
{
"page_index": 0,
"x": "string",
"y": "string",
"width": "string",
"height": "string"
}
],
"case_sensitive": false
}'