Image processing
An image can be shrunk and re-encoded right at upload — the result is what is stored and delivered.
Options
The same for POST /v1/files and POST /v1/uploads.
| Option | Values | What it does |
|---|---|---|
format |
ORIGINAL · WEBP · JPEG · PNG · AVIF |
Output format. ORIGINAL — keep it. |
quality |
1–100 | Quality. Without it — the default for the format. |
maxWidth |
16–10000 | Shrink to this width, keeping proportions. |
maxHeight |
16–10000 | Shrink to this height, keeping proportions. |
Without options the image is stored as is.
Default quality
| Format | quality |
|---|---|
| AVIF | 55 |
| PNG | 60 |
| WEBP, JPEG | 82 |
What happens
- Shrinking only. An image smaller than
maxWidth/maxHeightis not stretched. - EXIF rotation. A JPEG shot “sideways” is rotated and stored upright.
- Never larger than the source. If neither the size nor the format needs to change and the result comes out larger than the original, the original is stored.
- Animation is left alone. Animated GIF, WEBP and PNG (APNG) are stored as is.
What comes back
The processed field in the response shows what was done:
{
"applied": true,
"operations": ["resize:300x200", "encode:webp@82"],
"source": { "width": 600, "height": 400, "size": 3937, "mime": "image/png" },
"result": { "width": 300, "height": 200, "size": 444, "mime": "image/webp" }
}If no processing was needed, applied: false and the reason is in reason: animated,
nothing to do, output is larger than source.
Errors
| Code | When |
|---|---|
422 |
Options are given, but the file is not an image or its type cannot be processed |
422 |
Over 25 megapixels |
501 |
The server has no codec for the requested format |