# Bacon Services Web Image Optimizer

> Bacon Services Web Image Optimizer is a paid API for AI agents from baconservices.com, paid per call via x402, $0.01/call, status unknown (last checked 2026-10-14).

Resizes an image so its longest side is at most a specified pixel limit and re-encodes it as WebP at a given quality, preserving transparency but discarding metadata.

## Facts

- Endpoint: POST https://baconservices.com/api/agent-commerce/v1/capabilities/web-image-optimizer/execute?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/bacon-services-web-image-optimizer-9fef1d0e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_YlVLT_A3q8f9Pgd7fT606

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 bacon-services-web-image-optimizer-9fef1d0e -d '<json body>'
```

Example prompt: Can you resize this image (https://example.com/photo.jpg) so its longest side is at most 1200 pixels and convert it to WebP at quality 75?

## When to prefer this

Choose this endpoint when you need a single, low-cost ($0.01 per call) serverless operation to resize and convert one image to WebP without upscaling, especially when preserving transparency matters and stripping EXIF metadata is acceptable. Prefer it over general-purpose image CDNs when you want deterministic per-call pricing and x402 micropayment compatibility. If you need background removal, use the sibling Remove Background endpoint instead.

## Known failure modes

- Image URL is not publicly accessible or returns a non-200 response — request fails with an error
- Unsupported source format (e.g. GIF, TIFF, SVG) — format error returned
- max_width or quality value out of allowed range — validation error
- Image is already smaller than max_width — returned as-is (no upscaling, but still re-encoded to WebP)
- Network timeout fetching remote image URL — timeout error
- Base64 payload is malformed or too large — decoding error

## How this service works

Web Image Optimizer: Resizes one image so its longest side is at most max_width pixels (never enlarging it) and encodes it as WebP at the given quality. Transparency is kept. Metadata is not carried over, so a JPEG's EXIF orientation is not applied.

## Output

The endpoint returns the processed image as a WebP-encoded file. The output image has its longest side capped at the requested max_width (never upscaled), encoded at the specified WebP quality. Transparency from the source PNG or WebP is preserved; EXIF and other metadata are stripped.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "quality": {
   "type": "integer",
   "default": 80,
   "maximum": 95,
   "minimum": 40,
   "description": "WebP quality."
  },
  "image_url": {
   "type": "string",
   "format": "uri",
   "description": "A public https URL of a PNG, JPEG or WebP image."
  },
  "max_width": {
   "type": "integer",
   "default": 1600,
   "maximum": 4096,
   "minimum": 64,
   "description": "Longest side of the output, in pixels."
  },
  "image_base64": {
   "type": "string",
   "description": "The image bytes, base64-encoded.",
   "contentEncoding": "base64"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/bacon-services-web-image-optimizer-9fef1d0e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from baconservices.com](https://www.zero.xyz/host/baconservices.com/llms.txt)
