Documentation

Images API

The Images API allows you to serve and transform images on-the-fly. You can resize, crop, apply effects, and optimize images for different use cases.

Serve Image

Access and serve an image, with optional transformations applied on-the-fly.

Endpoint

bash
GET /file/:path

Path Parameters

ParameterTypeDescription
pathStringThe path to the image file

Query Parameters

ParameterTypeDescription
wIntegerWidth in pixels (1-5000)
hIntegerHeight in pixels (1-5000)
fitStringResize mode: cover, contain, fill, inside, outside
qIntegerQuality (1-100)
blurNumberBlur radius (0.3-1000)
sharpBooleanApply sharpening
grayBooleanConvert to grayscale
rotIntegerRotation angle (-360 to 360)
borderStringFormat: 'width_hexcolor' (e.g., '5_FF0000')
cropStringFormat: 'x,y,width,height'

Example Request

bash
curl https://api.getpronto.io/v1/file/image.jpg?w=800&h=600&fit=cover&q=90 \
  -H "ApiKey: YOUR_API_KEY"

The response will be the image data with appropriate content-type headers.

Generate Transform URL

Generate a URL for an image with specified transformations.

Endpoint

bash
POST /file/:id/transform-url

Path Parameters

ParameterTypeDescription
idStringThe unique identifier of the image

Request Body Parameters

ParameterTypeDescription
wIntegerWidth in pixels (1-5000)
hIntegerHeight in pixels (1-5000)
fitStringResize mode: cover, contain, fill, inside, outside
qIntegerQuality (1-100)
blurNumberBlur radius (0.3-1000)
sharpBooleanApply sharpening
grayBooleanConvert to grayscale
rotIntegerRotation angle (-360 to 360)
borderStringFormat: 'width_hexcolor' (e.g., '5_FF0000')
cropStringFormat: 'x,y,width,height'
formatStringOutput format (jpg, png, webp, etc)

Example Request

bash
curl -X POST https://api.getpronto.io/v1/file/123e4567-e89b-12d3-a456-426614174000/transform-url \
  -H "ApiKey: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "w": 800,
    "h": 600,
    "fit": "cover",
    "q": 90,
    "format": "webp"
  }'

Response

json
{
  "url": "https://api.getpronto.io/v1/file/image.webp?w=800&h=600&fit=cover&q=90",
  "originalFile": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "filename": "image.jpg",
    "mimetype": "image/jpeg"
  },
  "transformations": {
    "w": 800,
    "h": 600,
    "fit": "cover",
    "q": 90,
    "format": "webp"
  }
}

Transformation Options

The following transformations can be applied to images either via URL parameters or through the transform URL endpoint:

Resize

ParameterTypeDescription
w, hIntegerTarget dimensions (1-5000px)
fitStringHow image fits: cover (default), contain, fill, inside, outside

Example: w=800&h=600&fit=cover

Quality

ParameterTypeDescription
qIntegerJPEG/WebP quality (1-100)

Example: q=90

Effects

ParameterTypeDescription
blurNumberGaussian blur (0.3-1000)
sharpBooleanSharpen the image
grayBooleanConvert to grayscale

Example: blur=5&sharp=true&gray=true

Rotation & Cropping

ParameterTypeDescription
rotIntegerRotation angle (-360 to 360)
cropStringCrop coordinates (x,y,width,height)

Example: rot=90&crop=100,100,500,500

Note: Transformations are processed in the order they are specified. For example, if you apply both crop and resize, the image will be cropped first, then resized to the specified dimensions.

Next Steps

Continue exploring our documentation with these related topics: