- Media API
- Transformations
- Adjust
- trim
trim
The trim transformation automatically detects and removes uniform borders from images. Useful for removing whitespace, margins, or uniform colored edges while preserving important content.
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/trim:tolerance=TOLERANCE/ASSET_ID.jpgExamples
Default Trim (Auto-Detect)
curl -i GET https://media.vyso.io/trim/ASSET_ID.jpgTrim with Tolerance 10%
curl -i GET https://media.vyso.io/trim:tolerance=0.1/ASSET_ID.jpgConservative Trim
curl -i GET https://media.vyso.io/trim:tolerance=0.05/ASSET_ID.jpgAggressive Trim
curl -i GET https://media.vyso.io/trim:tolerance=0.2/ASSET_ID.jpgOn 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
toleranceOPTIONALColor tolerance for border detection. Accepted values:
- Range: 0.0 to 1.0 (ratio of max color difference)
0.01- Strict matching (exact color only)0.05- Conservative trim0.1- Standard trim (default)0.2- Aggressive trim (more forgiving)- Higher tolerance allows similar (but not identical) border colors to be removed
Response
The API returns the trimmed image with uniform borders removed. 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)