Image Convert

API key v1

Convert, 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.

POST https://api.zactonz.com/image/

Parameters

NameTypeDescription
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: webp (default), avif, jpeg, png, gif, or keep to keep the source 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

inside (default, shrink to fit, never enlarge), cover (fill and crop), contain (fit with padding, see background) or fill (stretch).

insidecovercontainfill
background string

Six hex digits used to flatten transparency and to pad contain. JPEG output is flattened on white when unset.

rotate integer

Clockwise degrees, 0 to 359. EXIF orientation is always applied first.

flip enum

h, v or both.

hvboth
grayscale boolean

1 converts to grayscale.

blur integer

Gaussian blur passes, 0 to 20.

sharpen boolean

1 applies a sharpening kernel.

info boolean

1 returns metadata and dominant colours as JSON without producing an image.

resp enum

image streams the bytes with X-Image-Width and X-Image-Height headers. json stores the result for 24 hours and returns its link with the metadata.

imagejson

Send parameters as application/x-www-form-urlencoded form fields in the request body.

Response

OK

FieldTypeDescription
status integer

200 on success.

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 info=1.

data.colors object

With info=1: dominant list of {hex, share} and the average colour.

data.image string

With resp=json: hosted link valid for 24 hours.

Status codes

The outcome is reported in the JSON status field. See Errors & status codes for the general rules.

400 Bad request

No file upload and no url were sent, or a parameter is invalid.

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 Retry-After.

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.