Convert an image.
POST/image/convert
Convert an image.
Request
Header Parameters
- application/json
Bodyrequired
The image URL
The image as a Base64-encoded buffer. Can be specified instead of url
.
The output format of the conversion.
Possible values: [jpeg
, jpg
, png
, gif
, tiff
, webp
]
Whether the image metadata should be converted, too.
options object
Quality. Applies to JPEG, PNG, WEBP, TIFF. Default for JPEG, WEBP, TIFF is 80. Default for PNG is 100.
Possible values: >= 1
and <= 100
80
Quality of alpha layer. Applies to WEBP. Default is 100.
Possible values: >= 0
and <= 100
100
Whether to use lossless compression. Applies to WEBP. Default is false
.
false
Whether to use near_lossless compression. Applies to WEBP. Default is false
.
false
Whether to use high quality chroma subsampling. Applies to WEBP. Default is false
.
false
Progressive (interlace) scan. Applies to JPEG, PNG, GIF. Default is false.
false
Chroma subsampling settings. 4:4:4
prevents subsampling if quality
is at most 90. Applies to JPEG. Default is 4:2:0
.
Possible values: [4:4:4
, 4:2:0
]
4:2:0
Whether to use trellis quantization. Applies to JPEG. Default is false
.
false
Whether to apply overshoot deringing. Applies to JPEG. Default is false
.
false
Whether to use optimized progressive scans. This enables progressive
. Applies to JPEG. Default is false
.
false
Alternative spelling of optimiseScans
.
Whether to use optimized Huffman coding tables. Applies to JPEG. Default is true
.
true
Alternative spelling of optimiseCoding
.
The quantization table that will be used. Applies to JPEG. Default is 0.
Possible values: >= 0
and <= 8
0
Alternative spelling of quantisationTable
.
Possible values: >= 0
and <= 8
Whether to use mozjpeg defaults. Default is false
.
false
The zlib compression level. Applies to PNG. Default is 6.
Possible values: >= 0
and <= 9
6
Whether adaptive row filtering should be used. Applies to PNG. Default is false
.
false
CPU effort for compression. For PNG and GIF, 1 is fastest, 10 is slowest, and enables palette
. Default is 7. For WEBP, 0 is fastest, 6 is slowest. Default is 4.
7
Use a palette-based image with an alpha channel. Applies to PNG. Default is false
.
false
Maximum number of colors in palette. Applies to PNG and GIF. Default is 256.
256
Alternative spelling of colours
.
Level of Floyd-Steinberg error diffusion. Applies to PNG and GIF. Default is 1.0.
1
Preset option. Applies to WEBP. Default is default
.
Possible values: [default
, photo
, picture
, drawing
, icon
, text
]
default
Compression option. Applies to TIFF. Default is jpeg
.
Possible values: [none
, jpeg
, deflate
, packbits
, ccittfax4
, lzw
, webp
, zstd
, jp2k
]
jpeg
Compression predictor setting. Applies to TIFF. Default is horizontal
.
Possible values: [none
, horizontal
, float
]
horizontal
Write an image pyramid. Applies to TIFF. Default is false
.
false
Enable tiling mode. Applies to TIFF. Deault is false
.
false
Horizontal tile size. Only applies when tile
is true. Applies to TIFF. Default is 256.
256
Vertical tile size. Only applies when tile
is true. Applies to TIFF. Default is 256.
256
Horizontal resolution in px/mm. Applies to TIFF. Default is 1.0.
1
Vertical resolution in px/mm. Applies to TIFF. Default is 1.0.
1
Reduce bitdepth. Applies to TIFF. Default is 8.
Possible values: [1
, 2
, 4
, 8
]
8
Write 1-bit images as miniswhite. Applies to TIFF. Default is false
.
false
Resolution unit. Applies to TIFF. Default is inch
.
Possible values: [inch
, cm
]
inch
Re-use existing palette, otherwise generate new (slow). Applies to GIF. Default is false
.
false
Maximum inter-frame error for transparency. 0 means lossless. Applies to GIF. Default is 0.
Possible values: >= 0
and <= 32
0
Maximum inter-palette error for palette reuse. Default is 3.
Possible values: >= 0
and <= 256
3
Whether the result image should be returned as a URL. Default is false
.
The file name of the result image. Default is a random ID.
Responses
- 200
- 400
Success
- application/json
- application/octet-stream
- Schema
- Example (auto)
Schema
The result image URL.
{
"url": "string"
}
- Schema
Schema
Bad Request
- application/json
- Schema
- Example (auto)
Schema
{
"status": 0,
"errorMessage": "string"
}