Skip to main content

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.

TransformationExamplesDescription
trim=tolerancetrim=20&resize=100,100 trim=10&resize=100,100request a trimmed image with tolerance

The transformation parameters are described below:-

ParameterDescription
tolerancecan 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

URLResult
https://cdn.filespin.io/api/v1/assets/{ASSET_ID}/conversions?trim=10&resize=100,100trimmed with tolerance 10, resized to fit 100x100