Compress images programmatically with quality control. Supports JPEG, PNG, WebP, AVIF with optional auto-resize. Perfect for AI agents processing images before storing or sending.
Compress and optimize images via a simple API call. Pass an image URL or base64, set the quality level (1โ100), choose output format (JPEG, PNG, WebP, AVIF), and optionally cap the width. Returns the compressed image as base64 with original/compressed sizes and reduction percentage.
| Field | Type | Description |
|---|---|---|
| image_url | string | Public HTTPS URL of the image (or use image_base64) |
| image_base64 | string | Base64 data URL (data:image/jpeg;base64,...) |
| quality | integer | Compression quality 1โ100 (default: 80) |
| format | string | Output format: jpeg, png, webp, avif (default: keep original) |
| max_width | integer | Max width in pixels; resizes if wider (keeps aspect ratio) |
$0.001 per request via x402 micropayment on Base (USDC).