---
title: "Compress an image"
method: POST
path: "/image/compress"
tags: ["Image"]
---

# Compress an image

`POST /image/compress`

## Request

- Base URL: `https://abundanceapis.com`
- URL: `https://abundanceapis.com/image/compress`
- Auth: none declared

Re-encode an image at a target quality to shrink its size. Defaults to WebP for the best compression; pass format to keep or choose another.

## Request body

- object
  - `url` string: Public image URL
  - `base64` string: Base64-encoded image (data URI ok)
  - `output` 'binary' | 'base64': Return the image bytes or JSON with base64
  - `format` 'jpeg' | 'png' | 'webp' | 'avif': Output format (default: keep input)
  - `quality` integer: Output quality (lossy formats)

## Other responses

- `400`: Bad request
- `502`: Could not load the image

---

[API](https://skmtc.dev/abundanceapis/apis/web-toolbox.md) · [All operations](https://skmtc.dev/abundanceapis/apis/web-toolbox/llms.txt) · [OpenAPI document](https://skmtc.dev/abundanceapis/apis/web-toolbox/revisions/ada2893fef43?raw)
