> For the complete documentation index, see [llms.txt](https://docs.scaleflex.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scaleflex.com/dynamic-media-optimization-dmo/transformations/image-optimization/operations/trim.md).

# Trim

Removes any single-color padding around the image if present.

The parameter does not specify the amount of border or frame to trim but rather how aggressive the trim algorithm should be. A bigger value of the parameter (e.g. 25) will trim rather more than not enough. Typical values are between 0 and 10.

This allows you to use the same parameter values for all your images.

<mark style="color:orange;">**trim=X**</mark>

{% hint style="info" %}
If the image is resized with the **width** and/or **height** commands, the resizing is performed *after* the border (if present) is trimmed.
{% endhint %}

## Examples

| Preview                          | Syntax                                                                                                                                                                                                                                                    |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](/files/nTu1mmJftuV5clkDBxkT) | <p>Original image:<br><a href="https://fdocs.filerobot.com/docs/painting_big.jpg?w=400">/docs/painting\_big.jpg?<mark style="color:orange;"><strong>w=400</strong></mark></a></p>                                                                         |
| ![](/files/SLNiKrkKHbx67I5F7eR3) | <p>Trimmed image:<br><a href="https://fdocs.filerobot.com/docs/painting_big.jpg?w=400&#x26;trim=10">/docs/painting\_big.jpg?<mark style="color:orange;"><strong>w=400</strong></mark>&<mark style="color:orange;"><strong>trim=10</strong></mark></a></p> |
| ![](/files/JicBUiLwMrl3iJ7kdquL) | <p>Original image:<br><a href="https://fdocs.filerobot.com/docs/sofa.jpg?w=400">/docs/sofa.jpg?<mark style="color:orange;"><strong>w=400</strong></mark></a></p>                                                                                          |
| ![](/files/XNDUcqyPuVjm5TXRqWiR) | <p>Trimmed image:<br><a href="https://fdocs.filerobot.com/docs/sofa.jpg?w=400&#x26;trim=10">/docs/sofa.jpg?<mark style="color:orange;"><strong>w=400</strong></mark>&<mark style="color:orange;"><strong>trim=10</strong></mark></a></p>                  |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.scaleflex.com/dynamic-media-optimization-dmo/transformations/image-optimization/operations/trim.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
