Trim
Trim removes the same color pixels from the edges of the image. This is useful when you want to remove the white space around an image.
info
trim can be combined with all other options.
| Transformation | Examples | Description |
|---|---|---|
trim=tolerance | trim=20&resize=100,100 trim=10&resize=100,100 | request a trimmed image with tolerance |
The transformation parameters are described below:-
| Parameter | Description |
|---|---|
tolerance | can be 0 to 10, where 0 compares edge pixel colors strictly and 10 treats them equal if they are close enough. A tolerance of 10 will trim even if they are small color gradient in surrounding pixels. |
Examples
Trim parameters go on the asset's on-demand image URL, like every other transformation, and combine with other options using &:
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?trim=10&resize=100,100
| URL | Result |
|---|---|
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?trim=10&resize=100,100 | trimmed with tolerance 10, resized to fit 100x100 |