Home  ›  Tool API  ›  Image Compression API

Image Compression API

Compress images without changing their format

Compress JPEG, PNG, WebP, AVIF, GIF, and TIFF images with a free REST API or browser tool. Preserve the source format and receive a temporary download URL.

Transparent usage terms REST + MCP Real browser tool

Working examples

Copy it into your stack.

Upload an image and choose a quality value. JPEG stays JPEG, PNG stays PNG, and supported modern formats remain in their source format.

Copyable requests

curl
curl -F "image=@photo.jpg" \
  -F "quality=70" \
  https://agentmediatools.com/api/compress-image
JavaScript
import { readFile } from "node:fs/promises";

const form = new FormData();
form.append("image", new Blob([await readFile("photo.jpg")]), "photo.jpg");
form.append("quality", "70");

const res = await fetch("https://agentmediatools.com/api/compress-image", {
  method: "POST",
  body: form
});
console.log(await res.json());
Python
import requests

with open("photo.jpg", "rb") as image:
    response = requests.post(
        "https://agentmediatools.com/api/compress-image",
        files={"image": image},
        data={"quality": 70},
    )

print(response.json())

Example JSON response

{
  "success": true,
  "originalSize": 4281042,
  "compressedSize": 621884,
  "savingsPercent": 85,
  "downloadUrl": "/downloads/d4e5f6.jpg"
}

Download URLs are temporary. Save results to your own storage when the workflow needs durable retention.

Frequently asked questions

Does compression change image dimensions?

Compression focuses on file size and quality. Use the resize tool when dimensions also need to change.

Can I choose output quality?

Yes. The browser tool and API accept quality controls for supported output formats.

Can this run in a batch workflow?

Yes. Use the browser batch tools or call the API from your own queue or agent pipeline.

One tool now, one integration later

Test it in the browser. Automate it when ready.

The same Agent Media Tools account connects this operation to the wider Tool API and MCP catalog.