Image Conversion
Converts an image's format, size and colour space: a web copy, an archival copy or a press copy of any image the server decodes.#
/lmkit/v1/image-convertRe-encodes any image the server decodes (JPEG, PNG, WebP, TIFF, HEIC, AVIF, GIF, BMP, PSD, ...) into 'output_format' - 'png' (default), 'jpeg', 'webp' or 'tiff' - with that encoder's settings: 'output_quality' for the lossy encoders, 'lossless' for WebP, 'progressive' for JPEG, 'tiff_compression' for TIFF. ONE optional resize: 'long_side' scales proportionally and never past the source unless 'allow_upscale' is true, 'width'+'height' force exact dimensions, 'fit_box' scales to fit inside a box and pads the rest. 'color_space' writes the samples in sRGB ('rgb'), one gray channel ('gray') or four inks ('cmyk', held by 'jpeg' and 'tiff' only) through an optional 'icc_profile' with a 'rendering_intent'; the conversion is colour-managed from the source's embedded profile. 'keep_metadata' carries EXIF, XMP, IPTC and the profile into the output, or writes a clean file. 'delivery' returns the bytes inline as base64 or as a stored 'file_id' to read from GET /lmkit/v1/files/. The response states what was written: format, content type, size, colour space, the embedded profile's name, and whether the pixels were resampled. GET /lmkit/v1/image-convert/capabilities says what this server's engine encodes. No AI model is involved: the pass is pure image processing and runs on any server. A payload that is not a decodable image is refused with 422 'invalid_image'; 'cmyk' asked of 'png' or 'webp' with 422 'unsupported_color_space'; a profile that is not an ICC profile, or of the wrong kind for the target, with 400 'invalid_argument'. 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 convert. Default: 0; an index past the last page is refused with 400. -1 asks for every page and is accepted with 'output_format' 'tiff' only: every page is resized and encoded under the same settings into one multipage TIFF ('pages' = 'source_pages'; 'width' and 'height' are the first page's). |
output_format | Encoding of the output. 'png' (default, lossless) and 'webp' keep any alpha channel; 'jpeg' cannot hold transparency and is flattened over opaque white; 'tiff' is lossless by default and the one container beside 'jpeg' that holds CMYK. | |
output_quality | object (int32) | Quality (1-100) for the lossy encodings: 'jpeg', lossy 'webp' and a 'tiff' under 'jpeg' compression. Ignored otherwise. Default: 80. |
lossless | boolean | Lossless WebP: every sample kept, 'output_quality' ignored. Read for 'webp' only. Default: false. |
progressive | boolean | Progressive JPEG: the picture sharpens in passes while loading. Read for 'jpeg' only. Default: false. |
tiff_compression | The TIFF codec: 'auto' (default), 'none', 'lzw', 'deflate', 'jpeg', 'ccitt_g4' or 'packbits'. Read for 'tiff' only. | |
long_side | object (int32) | Aspect-preserving resize: scales the image so its longer side measures this many pixels, at most 16384. A value larger than the source's longer side is clamped to the source unless 'allow_upscale' is true. Mutually exclusive with 'width'/'height' and 'fit_box'. Omit for no proportional resize. |
width | object (int32) | Exact resize: target width in pixels (at most 16384). Requires 'height'; mutually exclusive with 'long_side' and 'fit_box'. |
height | object (int32) | Exact resize: target height in pixels (at most 16384). Requires 'width'; mutually exclusive with 'long_side' and 'fit_box'. |
fit_box | Contain-fit resize: scales proportionally to fit inside the box (each side at most 16384) and pads the rest with the box's background colour, so the output measures exactly the box. Mutually exclusive with the other resizes. | |
allow_upscale | boolean | Whether a 'long_side' larger than the source may scale the picture up. Default: false - a copy is never larger than its master, and the response reports the size actually written. |
color_space | The colour space the samples are written in: 'original' (default), 'rgb', 'gray' or 'cmyk'. 'cmyk' is held by 'jpeg' and 'tiff' only; asking 'png' or 'webp' for it is refused with 422 'unsupported_color_space'. | |
icc_profile | string | Optional base64-encoded ICC profile of the target space: an RGB profile for 'rgb' (embedded in the output), a gray profile for 'gray', the printer's press profile for 'cmyk'. Omit for sRGB, the engine's gray profile and its generic CMYK profile respectively. Needs a 'color_space' other than 'original'; bytes that are not an ICC profile, or a profile of the wrong kind for the target, are refused with 400. |
rendering_intent | The rendering intent of the colour conversion: 'perceptual' (default), 'relative_colorimetric', 'saturation' or 'absolute_colorimetric'. | |
keep_metadata | boolean | Whether the source's metadata families - EXIF, XMP, IPTC, the ICC profile, text entries - are written into the output as far as the container holds them. Default: true. False writes a clean file (a converted colour space still embeds its target profile when the output needs one to be read correctly). |
delivery | How the bytes are delivered: 'inline' (default) as base64 in 'data', or 'file' as a stored file whose 'file_id' the response returns. |
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-convert" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "",
"input_format": "Base64EncodedFile",
"page_index": 0,
"output_format": "png",
"output_quality": 80
}'What the image conversion engine on this server can do.#
/lmkit/v1/image-convert/capabilitiesThe output formats this server encodes, the colour spaces accepted and the formats that hold each, the lossy formats and the ones with a lossless mode, the largest resize dimension, and the formats that carry metadata - derived from the engine, so a client offers only what the server honours. Cacheable for five minutes.
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK |
curl -X GET "$LMKIT_ONE_URL/lmkit/v1/image-convert/capabilities" \
-H "Authorization: Bearer $LMKIT_API_KEY"