Resize, convert or compress an image
transform_imageResize, convert or compress an image. Resizes (with a fit mode), converts between JPEG/PNG/WebP/AVIF and/or compresses ONE image. Provide at least one of width, height, format or quality. Input formats: PNG, JPEG, WebP, AVIF, GIF, TIFF.
Costs 1 credit per call.
Returns a temporary download link (valid 15 minutes). Always include that link in your reply so the user can open or download the file.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fit | No | How to fit when both width and height are given. | cover |
| file | Yes | The image, base64-encoded. | |
| width | No | Target width in pixels (1-8000). If you leave height empty, the aspect ratio is kept. | |
| format | No | Output format (default: same as input). | |
| height | No | Target height in pixels (1-8000). If you leave width empty, the aspect ratio is kept. | |
| quality | No | Compression quality from 1 to 100 for lossy formats (JPEG, WebP): higher = better image and bigger file. |