PrizmDoc v13.2 - Updated
Compression
API Reference > PrizmDoc Cloud-Hosted API > Compression

Compression

The Compression API allows you to reduce the file size of a JPEG, PNG, or GIF image without any loss of visual quality. The expected results are a new version of the input image that looks exactly the same visually, but occupies less space.

Available URLs

URL Description
POST /v1/imageReducers/{{filename}}?qualityFactor{quality}&removeMetadata={remove}&jpegMode={mode} Reduces the size of an image. This is the preferred method.
POST /{{api-key}}/reduce/{{filename}}?qualityFactor={quality}&removeMetadata={remove}&jpegMode={mode} Reduces the size of an image. This method is provided for backward-compatibility.

POST /v1/imageReducers/{{filename}}?qualityFactor{quality}&removeMetadata={remove}&jpegMode={mode}

Using this API, you can upload an image, reduce the image, and then receive the reduced image in response. The file contents are sent to the server in the body of the POST request.

Request

URL Parameters

Parameter Description
{filename} (String) The name of file to reduce (not a file path).
{quality} (Integer) JPEG files only. The desired quality of the output file. Acceptable values are: 0-255, where 0 is the highest quality/least amount of compression, and 255 is the lowest quality/most compression. The default setting is 22.
{remove} (Boolean) JPEG files only. Specifies whether to remove metadata from the output file. A value of true will remove the metadata; a value of false (default) will preserve any metadata.
{mode} (String) JPEG files only. Specifies the JPEG Mode of the output file. A value of sequential will convert the file to sequential mode; a value of progressive (default) will convert the file to progressive mode; a value of preserve will not change the current mode.

Request Headers

Name Description
acs-api-key Either acs-api-key OR Authorization is required {{api-key}}
Authorization Either acs-api-key OR Authorization is required Bearer {accessToken returned from OAuth service}

Request Body

The file contents of the file to reduce. This is the binary data for the image to be reduced. The calling application can include the data or a stream of the data.

Successful Response

Response Body

Success returns code 200 - OK

Error Responses

Status Code JSON errorCode Description
415 UnsupportedMediaType Returned when the input file is not a JPEG, PNG, or GIF
580 CompressReduceFailed Returned when an unexpected error occurs
580 InvalidInput Returned when qualityFactor is an invalid value
580 InvalidJpegMode Returned when jpegMode is an invalid value
580 InvalidRemoveMetadata Returned when removeMetadata is an invalid value

Examples

See our online examples here:

POST /{{api-key}}/reduce/{{filename}}?qualityFactor={quality}&removeMetadata={remove}&jpegMode={mode}

This API is provided for backward-compatibility; the preferred method of Compression is POST /v1/imageReducers/{{filename}}?qualityFactor{quality}&removeMetadata={remove}&jpegMode={mode}.

Request

URL Parameters

Parameter Description
{api-key} (String) Required. The license key of the registered user.
{filename} (String) The name of file to reduce (not a file path).
{quality} (Integer) JPEG files only. The desired quality of the output file. Acceptable values are: 0-255, where 0 is the highest quality/least amount of compression, and 255 is the lowest quality/most compression. The default setting is 22.
{remove} (Boolean) JPEG files only. Specifies whether to remove metadata from the output file. A value of true will remove the metadata; a value of false (default) will preserve any metadata.
{mode} (String) JPEG files only. Specifies the JPEG Mode of the output file. A value of sequential will convert the file to sequential mode; a value of progressive (default) will convert the file to progressive mode; a value of preserve will not change the current mode.

Request Headers

Name Description
acs-api-key Either acs-api-key OR Authorization is required {{api-key}}
Authorization Either acs-api-key OR Authorization is required Bearer {accessToken returned from OAuth service}

Request Body

The file contents of the file to reduce. This is the binary data for the image to be reduced. The calling application can include the data or a stream of the data.

Successful Response

Response Body

Success returns code 200 - OK

Error Responses

Status Code JSON errorCode Description
415 UnsupportedMediaType Returned when the input file is not a JPEG, PNG, or GIF
580 CompressReduceFailed Returned when an unexpected error occurs
580 InvalidInput Returned when qualityFactor is an invalid value
580 InvalidJpegMode Returned when jpegMode is an invalid value
580 InvalidRemoveMetadata Returned when removeMetadata is an invalid value

Examples

See our online examples here: