extract

The extract transformation isolates a single color channel (red, green, blue, or alpha) from an image and displays it as a grayscale image. Useful for analyzing channel data, creating masks, or performing advanced color operations.

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/extract:channel=CHANNEL/ASSET_ID.jpg

Examples

Extract Red Channel

curl -i GET https://media.vyso.io/extract:channel=red/ASSET_ID.jpg

Extract Green Channel

curl -i GET https://media.vyso.io/extract:channel=green/ASSET_ID.jpg

Extract Blue Channel

curl -i GET https://media.vyso.io/extract:channel=blue/ASSET_ID.jpg

Extract Alpha Channel

curl -i GET https://media.vyso.io/extract:channel=alpha/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

channelREQUIRED

Color channel to extract. Accepted values:

  • red - Red channel data
  • green - Green channel data
  • blue - Blue channel data
  • alpha - Transparency/alpha channel (if present)
  • hue - Hue component
  • saturation - Saturation component
  • lightness - Lightness/value component
  • Output displayed as grayscale image

Response

The API returns a grayscale image representing the extracted channel. 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)