Skip to main content
Domain: https://media.enad.io

Overview

The Media API provides image processing capabilities including resizing, cropping, format conversion, and various transformation effects.

Endpoints

Image Processing

GET /{app_id}/{filename} Process and transform images stored in R2 bucket with various options.

Path Parameters

Query Parameters

Fit Modes

  • contain - Resize to fit within dimensions, maintaining aspect ratio
  • cover - Scale to fill dimensions, cropping excess (centers crop unless crop_x/crop_y specified)
  • scale-down - Only resize if image is larger than target dimensions
  • crop - Scale and crop to exact dimensions
  • pad - Resize to fit and pad remaining space with transparent background
  • squeeze - Stretch/squash to exact dimensions, ignoring aspect ratio

Dimension Behavior

  • If only width is provided: height is calculated to maintain aspect ratio
  • If only height is provided: width is calculated to maintain aspect ratio
  • If both are provided: behavior depends on fit mode
  • If neither is provided: original dimensions are used

Examples

Response

  • Content-Type: Varies based on output format
    • image/png
    • image/jpeg
    • image/webp
    • image/avif
  • Status Codes:
    • 200 OK - Success
    • 400 Bad Request - Invalid parameters
    • 404 Not Found - Image not found
    • 500 Internal Server Error - Processing error

Limits

  • Dimensions: Maximum 5000x5000 pixels
  • Minimum Dimensions: At least 1 pixel
  • Image Quality: 0-100
  • Blur Range: 0.0-100.0
  • URL: Maximum 16 KB (typical HTTP limit)

Error Responses

All errors return appropriate HTTP status codes with descriptive messages:

400 Bad Request

Returned when:
  • Invalid dimensions (outside 1-5000 range)
  • Invalid fit mode for given dimensions
  • Invalid format specified
  • Invalid hex color format
  • Invalid blur value
  • Crop offsets exceed image bounds

404 Not Found

Returned when:
  • Requested image file doesn’t exist in bucket

500 Internal Server Error

Returned when:
  • Image processing fails
  • Internal Server Error