bluedot
Documentation / Convert

Convert image by uploading

This is a REST API provided by uploading the original image to convert an image in AVIF format.

Request

curl -x POST  
        https://avif-service-api.kokoon.cloud/avif/convert-direct
     -H "Authorization: <api_key>"
     -F "file_0=@example.jpeg"
     -F "convert_option=@convert_option.json;type=application/json"

List of request parameters (multipart/form-data format)

Parameter nameTypeDescription
file_0Image/PNG, Image/JPEG, Image/GIF, Image/WEBPThe file of the original image. (File)
convert_optionFile/JSONAs a JSON file defining the options to be converted, Convert with avid as much as the number of options in the compression_ratios array.

convert_option.json

{
  "compression_ratios" : ["level0", "level1", "level2", "level3"]
}
KeyTypeDescription
compression_ratioslevel0, level1, level2, level3This is a list of options when converting to avif. Up to 4, level0/level1/level2/level3 are the possible options, and if the compression_ratios parameter is not included in the request, ["level1"] is applied as default.

Regarding the value of levelN, the smaller the N, the lower the compression rate, but the better the image quality.

Response

{
  "id": "823f2450-2323-ds3f-ff3242ddsv2"
}

List of response parameters

Response fieldTypeDescription
idstringconversion id

Response error

Error nameStatusDescription
Insufficient storage507If the quota assigned to user (api-key) is exceeded.
Too many request429In case the number of concurrent avif-converts in the entire server is exceeded.
Forbidden403
  • 1. When providing images outside the range of 64x64<= size <= 8192x8192
  • 2. When providing image files with extensions other than supported
  • 3. This error occurs when other invalid options are provided.
<< PrevConvert image by providing URLNext >>Retrieve a list of conversion results