fill

The fill transformation resizes and crops an image to fill exact dimensions while maintaining aspect ratio. The image is scaled up or down and cropped from a specified gravity point (default: center) to achieve the target size. Perfect for creating thumbnails, social media images, and consistent gallery layouts.

Serving Content via CDN

The Media API is a CDN-based service that serves transformed images via GET requests. When you request a transformed image URL, the transformation is applied dynamically on the first request and then cached for subsequent requests.

URL Pattern

https://media.vyso.io/fill:width=W:height=H:gravity=G/ASSET_ID.jpg

Examples

Fill to 800x600

curl -i GET https://media.vyso.io/fill:width=800:height=600/ASSET_ID.jpg

Fill Square Thumbnail (200x200)

curl -i GET https://media.vyso.io/fill:width=200:height=200/ASSET_ID.jpg

Fill with Focus (Center)

curl -i GET https://media.vyso.io/fill:width=600:height=400:gravity=center/ASSET_ID.jpg

Fill with Face Focus (North)

curl -i GET https://media.vyso.io/fill:width=400:height=600:gravity=north/ASSET_ID.jpg

Fill Large Landscape

curl -i GET https://media.vyso.io/fill:width=1200:height=600/ASSET_ID.jpg

On the first request, you'll receive a X-Cache: MISS header while the transformation is applied and cached. Subsequent requests will return X-Cache: HIT.

Parameters

widthREQUIRED

Target width in pixels. Positive integer (e.g., 800).

heightREQUIRED

Target height in pixels. Positive integer (e.g., 600).

gravityOPTIONAL

Crop position/gravity. Accepted values:

  • center (default) - Crop from center
  • north - Crop from top
  • south - Crop from bottom
  • east - Crop from right
  • west - Crop from left

Response

The API returns an image resized and cropped to exactly the specified dimensions. The image is scaled and cropped from the gravity point to fill the target dimensions without distortion. The response format depends on the format of the asset stored in the Vyso asset cloud.

Content-Type: Determined by the stored asset format (e.g., image/jpeg, image/png)