---
title: trim
summary: null
url: https://www.fastly.com/documentation/reference/io/trim
---


Remove pixels from the edge of an image.

The `trim` parameter removes pixels from the edge of an image by pixel or percentage value. This can be useful for removing whitespace and borders that appear on a source image.

## Syntax

```text
trim={top},{right},{bottom},{left}
```

## Sub-parameters

|Param|Units	|Description|
|-------|-----------|
| `top` | Pixels or Percentage | Amount to trim from the top of the image. |
| `right` | Pixels or Percentage | Amount to trim from the right side of the image. |
| `bottom` | Pixels or Percentage | Amount to trim from the bottom of the image. |
| `left` | Pixels or Percentage | Amount to trim from the left side of the image. |

## Notes

1. Values can be specified using CSS style shorthand values. (See [CSS Margin](https://developer.mozilla.org/en-US/docs/Web/CSS/margin) or [CSS Padding](https://developer.mozilla.org/en-US/docs/Web/CSS/padding) for more examples).
1. CSS shorthand allows for all edges to be specified in one property.
1. Any fractional pixel measurements will be rounded to the nearest whole pixel.

## Examples

Click the links to view the transformed image using a demo Fastly IO service.

|Example usage|Description|
|-----------|-------------|
|[`?trim=25,50,75,100`](https://www.fastly.io/image.jpg?trim=25,50,75,100)|Trim top edge 25px, right edge 50px, bottom edge 75px and left edge 100px|
|[`?trim=25,50,75`](https://www.fastly.io/image.jpg?trim=25,50,75)|Trim top edge 25px, right and left edge 50px, bottom edge 75px|
|[`?trim=25,50`](https://www.fastly.io/image.jpg?trim=25,50)|Trim top and bottom edge 25px, right and left edge 50px|
|[`?trim=0.25`](https://www.fastly.io/image.jpg?trim=0.25)|Trim all edges by 25%|
