PNG, JPEG, WebP, AVIF

Image Resize & Convert API

Resize, crop, and convert images between formats with a single POST request. Pass an image URL or upload directly. No image processing libraries to install.

Parameters

ParamRequiredDescription
url / imageRequiredURL of the image or base64 string (or multipart file upload)
widthOptionalTarget width in pixels (max 4096)
heightOptionalTarget height in pixels (max 4096)
formatOptionalOutput format: png, jpeg, webp, avif (default png)
qualityOptionalQuality 1-100 for jpeg/webp/avif (default 80)
fitOptionalResize fit: cover, contain, fill, inside, outside (default cover)

Code Examples

cURL (URL input)

curl -X POST "https://api-snap.com/api/resize" \
  -H "Authorization: Bearer snp_your_key" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/photo.jpg","width":400,"format":"webp"}' \
  -o resized.webp

JavaScript

const res = await fetch("https://api-snap.com/api/resize", {
  method: "POST",
  headers: {
    Authorization: "Bearer snp_your_key",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://example.com/photo.jpg",
    width: 800,
    height: 600,
    format: "webp",
    quality: 85,
  }),
});
const blob = await res.blob();

Python

import requests

r = requests.post(
    "https://api-snap.com/api/resize",
    headers={"Authorization": "Bearer snp_your_key"},
    json={"url": "https://example.com/photo.jpg", "width": 400, "format": "avif"},
)
with open("thumb.avif", "wb") as f:
    f.write(r.content)

Common Use Cases

Thumbnail generation

Create consistent thumbnails from user uploads for galleries and profiles

Format conversion

Convert PNG/JPEG to WebP or AVIF for faster page loads and bandwidth savings

Responsive images

Generate multiple sizes from a single upload for srcset and responsive layouts

Social media assets

Resize images to platform-specific dimensions for Open Graph, Twitter cards, etc.

E-commerce catalogs

Process product images into uniform sizes across your storefront

Content pipelines

Automate image processing in CI/CD or CMS workflows without local dependencies

Start Processing Images

No Sharp, no ImageMagick, no dependencies. Just an API call.

Get Your Free API Key