threshold

The threshold transformation converts an image to pure black and white by comparing pixel intensity against a threshold value. Pixels brighter than the threshold become white; darker pixels become black. Perfect for document scanning, OCR preparation, and high-contrast artistic effects.

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/threshold:value=VALUE/ASSET_ID.jpg

Examples

Dark Threshold (50% Intensity)

curl -i GET https://media.vyso.io/threshold:value=50/ASSET_ID.jpg

Medium Threshold (128)

curl -i GET https://media.vyso.io/threshold:value=128/ASSET_ID.jpg

Standard Threshold (150)

curl -i GET https://media.vyso.io/threshold:value=150/ASSET_ID.jpg

Bright Threshold (200)

curl -i GET https://media.vyso.io/threshold:value=200/ASSET_ID.jpg

High Threshold for Fine Details (175)

curl -i GET https://media.vyso.io/threshold:value=175/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

valueREQUIRED

Threshold intensity value. Accepted values:

  • Range: 0 to 255
  • 50 - Very low threshold (more white)
  • 128 - Mid-point (balanced)
  • 150 - Standard threshold (most common)
  • 200 - High threshold (more black)
  • Pixels with intensity ≥ threshold become white; intensity < threshold become black

Response

The API returns a black and white binary image. 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)