- Media API
- Transformations
- Resize
- avatar
avatar
The avatar transformation generates optimized circular or square profile avatars from images. Automatically crops faces or center content and resizes to specified dimensions. Perfect for user profiles, social media, and identity displays.
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/avatar:size=SIZE:shape=SHAPE/ASSET_ID.jpgExamples
Small Avatar (64x64)
curl -i GET https://media.vyso.io/avatar:size=64/ASSET_ID.jpgStandard Avatar (128x128)
curl -i GET https://media.vyso.io/avatar:size=128/ASSET_ID.jpgMedium Avatar (256x256)
curl -i GET https://media.vyso.io/avatar:size=256/ASSET_ID.jpgLarge Avatar (512x512)
curl -i GET https://media.vyso.io/avatar:size=512/ASSET_ID.jpgAvatar with Border
curl -i GET https://media.vyso.io/avatar:size=256:border=2:border_color=000000/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
sizeREQUIREDAvatar dimension in pixels (square). Accepted values:
- Range: 32 to 2000+
64- Small avatar128- Standard avatar (default)256- Medium avatar512- Large avatar
shapeOPTIONALAvatar shape. Accepted values:
square- Square shape (default)circle- Circular avatar
borderOPTIONALBorder width in pixels. Positive integer (e.g., 2).
border_colorOPTIONALBorder color (hex format without #). Only used if border is specified.
Response
The API returns an optimized avatar image at the specified size and shape. 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)