Image optimization in one HTTP call

Compress, resize and convert — including the formats browsers cannot decode, like HEIC and RAW. Describe what you want in query parameters and get the optimized bytes back. Private beta.

Optimize an image

POST https://api.pixelsqueeze.dev/v1/optimize
Authorization: Bearer ps_live_xxx
Content-Type: image/jpeg

# query parameters
?format=webp&quality=82&w=1280&strip_metadata=true

Send raw bytes and get raw bytes back, so you can stream a file straight from your storage provider without base64 overhead.

Multiple output variants in one request

The common case is not one file — it is one source image and four widths for responsive markup. Ask for them together and we return a small JSON manifest plus URLs.

curl -X POST "https://api.pixelsqueeze.dev/v1/variants" \
  -H "Authorization: Bearer ps_live_xxx" \
  -H "Content-Type: image/heic" \
  --data-binary @IMG_4821.heic \
  -d 'widths=400,800,1200,1920' -d 'format=avif,webp'

# 200 OK
{
  "source": { "width": 3024, "height": 4032, "bytes": 3421888, "format": "heic" },
  "variants": [
    { "width": 400,  "format": "webp", "bytes": 18422,  "url": "https://cdn.pixelsqueeze.dev/v1/o/8f3a-400.webp" },
    { "width": 800,  "format": "webp", "bytes": 51330,  "url": "https://cdn.pixelsqueeze.dev/v1/o/8f3a-800.webp" },
    { "width": 1200, "format": "avif", "bytes": 41208,  "url": "https://cdn.pixelsqueeze.dev/v1/o/8f3a-1200.avif" },
    { "width": 1920, "format": "webp", "bytes": 121774, "url": "https://cdn.pixelsqueeze.dev/v1/o/8f3a-1920.webp" }
  ],
  "total_bytes_saved": 3259044,
  "elapsed_ms": 412
}

Parameters

ParameterTypeDefaultNotes
formatstringwebpwebp, avif, jpeg, png. Comma-separated to receive several.
quality1–10082Ignored for PNG unless you set lossy=true.
wintoriginalMax width, never upscales. Use widths for multiple.
hintautoAspect ratio is preserved unless you also pass fit=cover.
strip_metadatabooltrueRemoves EXIF, including GPS. Set false to keep camera data.
fitstringinsideinside, cover, fill, pad. pad takes a background colour.
storeboolfalsePersist variants and return CDN URLs instead of inline bytes.

Error responses are JSON with a stable code and a human message: unsupported_format, image_too_large, quota_exceeded, corrupt_input.

What it is designed for

Upload pipelines

Hook it into the moment a user uploads: convert, resize, strip EXIF, push variants to your bucket. One call instead of a queue, a worker and a resize service.

Static builds

Run the CLI in CI over your public/img folder and fail the build if a page's images exceed a byte budget you set.

Formats browsers can't read

HEIC and RAW photos are decoded server-side, which is exactly what the free in-browser tool cannot do.

Being predictable

Flat monthly tiers, documented limits, no credit maths. Overages are billed at $0.50 per 1,000 images and never cut the service off mid-deploy.

API FAQ

Is the API available right now?

Not yet — it is in private beta and we are onboarding a small group to keep latency and quality honest. Leave your email and you get access plus 50% off the first three months.

What are the rate limits?

Pro: 20 requests/second and 10,000 images per month. Scale: 100 requests/second and 100,000 images per month. Concurrency is pooled, so bursts are fine as long as the monthly total holds.

Where are files stored?

Inline responses are processed in memory and discarded as soon as the response is sent. If you pass store=true, variants are kept on the CDN for 30 days unless you delete them; you can turn persistence off per key.

Can I run it in my own infrastructure?

Yes, a self-hosted docker image with a perpetual licence is available for teams that cannot send images to a third party.

Get an API key

Beta keys are handed out by email. Tell us roughly how many images a month you handle and what you are converting from.