Image Convert
API key v1Convert, resize, crop and analyse images: WebP, AVIF, JPEG, PNG and GIF.
Accepts an upload or a public URL, applies EXIF orientation, resizes with your chosen fit, optionally rotates, flips, blurs, sharpens or grayscales, strips all metadata and encodes to the format you ask for. info=1 returns dimensions, format, transparency, orientation and a five-colour dominant palette instead of an image.
https://api.zactonz.com/image/
Parameters
| Name | Type | Description |
|---|---|---|
file |
string |
The image as a multipart upload. JPEG, PNG, GIF, WebP, AVIF or BMP, up to your plan's upload limit. |
url |
string |
Public URL of the image instead of an upload. |
format |
enum |
Output format: webpavifjpegpnggifkeep |
quality |
integer |
1 to 100 for lossy formats. Default
82 |
width |
integer |
Target width in pixels, up to 8000. Omit to derive from the height. |
height |
integer |
Target height in pixels, up to 8000. Omit to derive from the width. |
fit |
enum |
insidecovercontainfill |
background |
string |
Six hex digits used to flatten transparency and to pad |
rotate |
integer |
Clockwise degrees, 0 to 359. EXIF orientation is always applied first. |
flip |
enum |
hvboth |
grayscale |
boolean |
|
blur |
integer |
Gaussian blur passes, 0 to 20. |
sharpen |
boolean |
|
info |
boolean |
|
resp |
enum |
imagejson |
Send parameters as application/x-www-form-urlencoded form fields in the request body.
Response
OK
| Field | Type | Description |
|---|---|---|
status |
integer |
|
data |
object | The result. |
data.source |
object | Dimensions, format, byte size, EXIF orientation, animation and alpha of the input. |
data.output |
object | Dimensions, format, byte size and quality of the result. Absent with |
data.colors |
object | With |
data.image |
string | With |
Status codes
The outcome is reported in the JSON status field. See Errors & status codes for the general rules.
400 |
Bad request | No |
413 |
Too large | The upload exceeds your plan's limit or the image exceeds 25 megapixels. |
415 |
Unsupported | The bytes are not a JPEG, PNG, GIF, WebP, AVIF or BMP image. |
401 |
Unauthorized | The Authorization header is missing or the key is not recognised. |
403 |
Forbidden | The key is not licensed for this product. |
429 |
Too many requests | The per-minute rate or the plan quota is exhausted. Retry after the seconds given in |
Notes
Send the image as a multipart/form-data upload named file, or pass url. Images over 25 megapixels or 8000 pixels on a side are refused before decoding. SVG input is not accepted. Metadata is never carried over to the output.