backgroundColor

The backgroundColor transformation fills transparent or padded areas with a background color. This is useful when you need non-transparent images for platforms that don't support alpha channels or when you want to create consistent backgrounds for thumbnails.

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/background-color:color=olive/ASSET_ID.jpg

Examples

Basic Usage with Hex Color

curl -i GET https://media.vyso.io/background-color:color=%23ffffff/ASSET_ID.jpg

Using Named Color

curl -i GET https://media.vyso.io/background-color:color=olive/ASSET_ID.jpg

With Optional Mode Parameter

curl -i GET https://media.vyso.io/background-color:color=%23000000:mode=flatten/ASSET_ID.jpg

Different Image Format

curl -i GET https://media.vyso.io/background-color:color=%23ff5733/ASSET_ID.png

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

colorREQUIRED

Background color value. Accepted formats:

  • Hex value without # (e.g., ffffff, ff5733)
  • RGB format (e.g., rgb(128,0,128))
  • CSS-valid color names (e.g., olive, cyan, red)

Response

The API returns the transformed image with the specified background color applied to any transparent or padded areas. 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)