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

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.

Inputs of Image Compressor
FieldTypeDefaultDescription
file (required)file—Image. JPG, PNG, WebP, AVIF or GIF (first frame), max 30 MB.
formatselect (webp, avif, jpeg, png)"webp"Output format
qualityinteger75Quality. 1 = smallest file, 100 = best quality. Ignored for PNG, which is always lossless.
maxWidthinteger—Maximum width. Optional. Larger images are scaled down proportionally; smaller ones are never enlarged.
maxHeightinteger—Maximum height. Optional. Applied together with the maximum width.
stripMetadatabooleantrueRemove 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)

{
  "mcpServers": {
    "image-compressor": { "type": "http", "url": "https://imagecompressor.usefulweb.site/mcp" }
  }
}