# x402 Image Tools – Compress

> x402 Image Tools – Compress is a paid API for AI agents from image.kagurazaka.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-29).

Re-encodes a JPEG, PNG, or other image to reduce file size using mozjpeg/palette quantization, optionally scaling it down or converting format, and reports bytes saved.

## Facts

- Endpoint: POST https://image.kagurazaka.dev/v1/compress?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-image-tools-compress-99b855d8
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_yp5o5Z0dHpmNgshmyRdO_

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-image-tools-compress-99b855d8 -d '<json body>'
```

Example prompt: Can you compress this image for me — https://example.com/photo.jpg — convert it to WebP at quality 75 and scale it down to a max width of 1200 pixels, then tell me how much space was saved?

## When to prefer this

Choose this endpoint when you need to reduce an image's byte size for bandwidth, storage, or page-load reasons — especially when you want a byte-savings report alongside the result. It is preferable to a generic format-conversion endpoint when compression metrics (saved_percent, input_bytes vs output_bytes) matter, or when mozjpeg/palette quantization quality is desired. Use it over a resize endpoint when byte reduction is the primary goal and resizing is secondary.

## Known failure modes

- Image URL is unreachable or returns a non-200 response — service cannot fetch the source image
- Image exceeds 20 MB or 40 megapixel limit — request rejected
- Unsupported input format — only JPEG, PNG, WebP, AVIF, GIF, TIFF, SVG accepted
- Quality value out of 1-100 range — validation error
- Compressed result URL expires after 3600 seconds — subsequent access returns 403/404
- Network timeout fetching large source image

## How this service works

Make an image smaller in bytes: re-encode it (mozjpeg for JPEG, palette quantization for PNG) with metadata removed, optionally scaled down to a maximum width or converted, and report how much was saved.

## Output

A JSON object containing a CDN URL to the compressed image (valid for ~1 hour), the output file size in bytes, original file size in bytes, percentage saved, output dimensions (width × height), and format. Optionally includes the image as a data URL if inline was requested and the result is ≤1 MB.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "url": {
   "type": "string",
   "description": "https URL of a JPEG, PNG, WebP, AVIF, GIF, TIFF or SVG image (up to 20 MB, 40 megapixels)"
  },
  "format": {
   "enum": [
    "webp",
    "avif",
    "png",
    "jpeg",
    "gif",
    "tiff"
   ],
   "type": "string",
   "description": "output format (default: the input's)"
  },
  "inline": {
   "type": "boolean",
   "description": "also return the image as a data URL when it is at most 1 MB"
  },
  "quality": {
   "type": "integer",
   "description": "1-100 (default 75)"
  },
  "max_width": {
   "type": "integer",
   "description": "scale down to at most this width"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "url": "https://dn8i8p8knpn68.cloudfront.net/results/images/3f1c2b9e.webp?Expires=...",
  "bytes": 48213,
  "width": 800,
  "format": "webp",
  "height": 600,
  "expires_in": 3600,
  "input_bytes": 912345,
  "saved_percent": 62.4
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-image-tools-compress-99b855d8/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from image.kagurazaka.dev](https://www.zero.xyz/host/image.kagurazaka.dev/llms.txt)
