Identify a rectangular border based on specified or auto-detected color and remove this border from the edges of an image.
IMPORTANT: Trim by color currently only works for non-GIF input images. It is applied first, before any other transformation. Trims resulting in 0x0 images return an error.
|Color||Indicates what color to trim off, or |
|Number||An optional number between 0 and 1 indicating how different a color can be from the given trim color and still be trimmed. This can be used if the background that is being trimmed is not uniform (all one color). Setting it to 1 will trim everything, as 1 is the largest possible color difference.|
color may be one of:
- Hex RGB value: Both 3- and 6-digit values are acceptable (e.g.,
- Decimal RGB: RGB values between 0 and 255. Comma-delimited (e.g.,
- Decimal RGB with alpha: RGBA colors include an additional value for alpha (transparency), which ranges from 0 for fully transparent to 1 for fully opaque. Comma-delimited (e.g.,
|Trim off a black background|
|Trim off a white background with 0.5 transparency|
|Trim off a white background with a threshold of 0.3|
|Auto detect the color to trim by looking at the top left most pixel|
|Trim off an entirely transparent background|