- Media API
- Transformations
- Resize
- fill
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.jpgExamples
Fill to 800x600
curl -i GET https://media.vyso.io/fill:width=800:height=600/ASSET_ID.jpgFill Square Thumbnail (200x200)
curl -i GET https://media.vyso.io/fill:width=200:height=200/ASSET_ID.jpgFill with Focus (Center)
curl -i GET https://media.vyso.io/fill:width=600:height=400:gravity=center/ASSET_ID.jpgFill with Face Focus (North)
curl -i GET https://media.vyso.io/fill:width=400:height=600:gravity=north/ASSET_ID.jpgFill Large Landscape
curl -i GET https://media.vyso.io/fill:width=1200:height=600/ASSET_ID.jpgOn 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
widthREQUIREDTarget width in pixels. Positive integer (e.g., 800).
heightREQUIREDTarget height in pixels. Positive integer (e.g., 600).
gravityOPTIONALCrop position/gravity. Accepted values:
center(default) - Crop from centernorth- Crop from topsouth- Crop from bottomeast- Crop from rightwest- 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)