Resize / fit / convert / compress / rotate an image

Resizes, crops, converts, rotates and compresses an image. Returns the new image bytes.

Request

POSThttps://image-tools.p.apihiver.com/v1/transform

Upload the image in the file field (max 25 MB). Instead of a file you can send JSON: {"url": "https://…"} for a public image URL, or {"base64": "…"} — the options below then go in the same JSON object.

*
No file chosen
File. The image file (JPG, PNG, WebP, GIF, BMP or TIFF).
Integer. Target width in px (aspect ratio kept if only one side is given).
Integer. Target height in px.
String. contain (fit inside), cover (fill and crop) or exact (stretch).
String. jpeg, png, webp, gif, bmp or tiff (default: same as input).
Integer. 1–100, for JPEG/WebP.
Integer. 90, 180 or 270 degrees clockwise.
Boolean. true converts to black & white.

Parameters and body structure are inherited from this endpoint's definition. Changes here only apply to this test run.

Language
Client
1curl --request POST \
2  --url https://image-tools.p.apihiver.com/v1/transform \
3  --header 'Accept: application/json' \
4  --header 'X-API-Key: YOUR_API_KEY' \
5  --header 'content-type: multipart/form-data' \
6  --form file=@file.bin \
7  --form width=800 \
8  --form fit=contain \
9  --form format=webp \
10  --form quality=85 \
11  --form grayscale=false

Resize / fit / convert / compress / rotate an image: Image Tools API reference

Resizes, crops, converts, rotates and compresses an image. Returns the new image bytes. This endpoint is part of the Image Tools API: Resize, crop, convert, rotate and compress images, add text watermarks, extract colour palettes and make placeholder images.

Example response (200, image/*)

The processed image. Headers `X-Original-Size`, `X-Output-Size`, `X-Output-Width`, `X-Output-Height`.

Errors

  • 400 — A required parameter is missing or a value has the wrong format.
    1{
    2  "error": {
    3    "code": "INVALID_INPUT",
    4    "message": "Provide a file upload, 'url', or 'base64'."
    5  }
    6}

Gateway errors (missing key, no subscription, rate limits) are listed in Error codes.