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.jpg

Examples

Small Avatar (64x64)

curl -i GET https://media.vyso.io/avatar:size=64/ASSET_ID.jpg

Standard Avatar (128x128)

curl -i GET https://media.vyso.io/avatar:size=128/ASSET_ID.jpg

Medium Avatar (256x256)

curl -i GET https://media.vyso.io/avatar:size=256/ASSET_ID.jpg

Large Avatar (512x512)

curl -i GET https://media.vyso.io/avatar:size=512/ASSET_ID.jpg

Avatar with Border

curl -i GET https://media.vyso.io/avatar:size=256:border=2:border_color=000000/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

sizeREQUIRED

Avatar dimension in pixels (square). Accepted values:

  • Range: 32 to 2000+
  • 64 - Small avatar
  • 128 - Standard avatar (default)
  • 256 - Medium avatar
  • 512 - Large avatar
shapeOPTIONAL

Avatar shape. Accepted values:

  • square - Square shape (default)
  • circle - Circular avatar
borderOPTIONAL

Border width in pixels. Positive integer (e.g., 2).

border_colorOPTIONAL

Border 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)