API & MCP
Everything a person can do on Image Compressor, a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://imagecompressor.usefulweb.site/api/v1/calculate– run Image CompressorGET https://imagecompressor.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Image Compressor
Re-encodes an image as WebP, AVIF, JPEG or PNG at the quality you choose, optionally scales it down to a maximum width or height and removes metadata such as GPS location. Shows the before/after size, the saving and the new dimensions, with a preview and a download.
| Field | Type | Default | Description |
|---|---|---|---|
file (required) | file | — | Image. JPG, PNG, WebP, AVIF or GIF (first frame), max 30 MB. |
format | select (webp, avif, jpeg, png) | "webp" | Output format |
quality | integer | 75 | Quality. 1 = smallest file, 100 = best quality. Ignored for PNG, which is always lossless. |
maxWidth | integer | — | Maximum width. Optional. Larger images are scaled down proportionally; smaller ones are never enlarged. |
maxHeight | integer | — | Maximum height. Optional. Applied together with the maximum width. |
stripMetadata | boolean | true | Remove metadata (EXIF, GPS location, camera details, colour profile comments) |
Example request
PNG gradient to WebP
curl -X POST https://imagecompressor.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"file":{"filename":"gradient.png","contentType":"image/png","contentBase64":"iVBORw0KGgoAAAANSUhEUgAAADAAAAAgEAIAAACLJrAIAAAAvElEQVRo3u3ZIRLDMAxE0XZmPSqzUA4W3h40uVRwQgqEJcEE/HcCg7W1tt/Lsq7H8UJCNsd2fe9exnPJXPv5u3sZz0WCGrI5SFBBNrWdJCgl87FdJCgVW4wEpWRzbJxBOZmLKVZgijVii5GglGyOnSmWkzk9qBJXDRKUogc19HHRgwpxSJOgFE26IXN6UEU2RQ8q0KQb3MUa8WBGglLx5EqCUvSgRox5EpTiV6PBe1CDHtSQOT2oIpv8alT+GThGqh2cdAQAAAAASUVORK5CYII="},"format":"webp","quality":75}'
Every result contains
inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.
MCP (Model Context Protocol)
- Streamable HTTP endpoint:
https://imagecompressor.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
image_compressor - Local stdio connector:
node src/mcp-stdio.ts --tool=image-compressor
{
"mcpServers": {
"image-compressor": { "type": "http", "url": "https://imagecompressor.usefulweb.site/mcp" }
}
}