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
trim={top},{right},{bottom},{left}
Sub-parameters
Param | Units |
---|---|
top | Pixels or Percentage |
right | Pixels or Percentage |
bottom | Pixels or Percentage |
left | Pixels or Percentage |
Notes
- Values can be specified using CSS style shorthand values. (See CSS Margin or CSS Padding for more examples).
- CSS shorthand allows for all edges to be specified in one property.
- 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 | Trim top edge 25px, right edge 50px, bottom edge 75px and left edge 100px |
?trim=25,50,75 | Trim top edge 25px, right and left edge 50px, bottom edge 75px |
?trim=25,50 | Trim top and bottom edge 25px, right and left edge 50px |
?trim=0.25 | Trim all edges by 25% |