Sharp-powered processing
JPEG · PNG · WebP · HEIC · AVIF
6MB Limit
Health + Metrics

Image Processing API

A production-ready image processing REST API to resize, compress, convert, crop, and run multi-step pipelines. Designed for reliability with consistent outputs, health checks, metrics, and predictable error handling.

/health
/metrics

Endpoints @ A Glance

Start with /process for multi-step workflows, or call single-operation endpoints directly.
GET/
Service Info
Returns supported operations + formats (great for quick integration checks).
POST/process
Recommended
Pipeline (multi-step)
Run multiple operations in one request (resize → convert → metadata, etc.).
POST/resize
Resize
High-quality resize with optional dimensions.
POST/compress
Compress
Quality-controlled compression (default 80).
POST/convert
Convert
Convert between jpeg/png/webp with optimized settings.
POST/crop
Crop
Crop by x/y and size with bounds validation.
POST/upload
Upload (test)
Upload + return original image (validation).
GET/health
Health Check
Service status, uptime, env, temp dir.
GET/metrics
Prometheus Metrics
Request counts, histograms, error rate.

Pipeline + Production

Chain multiple image operations into a single request, then deploy with confidence using production-ready endpoints, metrics, and health checks.
Pipeline: resize → convert → metadata

One request, multiple operations. Ideal for “ingest then optimize” flows.

{
  "image_url": "https://example.com/image.jpg",
  "operations": [
    { "operation": "resize", "width": 512, "height": 512 },
    { "operation": "convert", "format": "webp" },
    { "operation": "metadata" }
  ],
  "output": { "type": "json" }
}
Output can be binary image or JSON depending on your pipeline.
Production-ready by default

Monitoring routes + consistent error shapes make it easy to operate.

Health

https://datpaq.com/api/v1/image-processing/health

Status, version, uptime, environment, temp directory.

Metrics

https://datpaq.com/api/v1/image-processing/metrics

Prometheus request counts, histograms, and error rate.

Supported formats

Input: JPEG
Input: PNG
Input: WebP
Input: GIF
Input: BMP
Input: TIFF
Output: JPEG
Output: PNG
Output: WebP

Legacy routes

Backwards compatible endpoints exist without the /api/v1 prefix (e.g. /resize /api/v1/resize).

Error Handling

When something goes wrong, responses are explicit and structured—making failures easy to understand, trace, and recover from.
Example error response
{
  "error": "Unsupported image format",
  "correlationId": "req-123456789"
}

Predictable error handling

Common failure cases return clear HTTP codes + a correlation ID for debugging.

400 Bad Request
404 Not Found
413 Payload Too Large
422 Unprocessable Entity
500 Internal Server Error
Ship image workflows faster

Replace ad-hoc scripts with a stable API: resize for thumbnails, convert to WebP, compress for performance, and monitor it all in production.

Image Processing API | Resize, Compress, Convert, Crop | Datpaq | DATPAQ