grayscale

The grayscale transformation converts an image to grayscale, preserving luminance variations with multiple shades of gray (unlike black-and-white which uses only two colors). Optionally adjust the lightness to make the result brighter or darker. Perfect for creating vintage effects, archival images, or reducing visual noise.

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/grayscale/ASSET_ID.jpg

Examples

Standard Grayscale Conversion

curl -i GET https://media.vyso.io/grayscale/ASSET_ID.jpg

Grayscale with Lightness Increase

curl -i GET https://media.vyso.io/grayscale:lightness=30/ASSET_ID.jpg

Grayscale with Lightness Decrease (Darker)

curl -i GET https://media.vyso.io/grayscale:lightness=-20/ASSET_ID.jpg

Bright Grayscale

curl -i GET https://media.vyso.io/grayscale:lightness=50/ASSET_ID.jpg

Dark Grayscale

curl -i GET https://media.vyso.io/grayscale:lightness=-40/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

lightnessOPTIONAL

Optional lightness adjustment to the grayscale output. Adjust the overall brightness after converting to grayscale. Accepted values:

  • Range: -100 to 100
  • 0 - Standard grayscale (no lightness adjustment, default)
  • Negative values (e.g., -20) - Darken the grayscale image
  • Positive values (e.g., 30) - Lighten the grayscale image
  • Decimal values are supported for fine-tuned adjustments

Response

The API returns a grayscale version of the image with multiple shades of gray preserving luminance information. If lightness adjustment is applied, the grayscale output is brightened or darkened accordingly. 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)