# Operations

Resizing operations enable the dynamic generation of image transformations to meet various web delivery use cases. Operations focus on the image size while [filters](https://docs.scaleflex.com/dynamic-media-optimization-dmo/transformations/image-optimization/filters "mention") allow to modify the image itself.

## Available operations <a href="#od_e8ec73ce" id="od_e8ec73ce"></a>

<table><thead><tr><th width="223.33333333333331">Operation</th><th width="168">Syntax</th><th>Description</th></tr></thead><tbody><tr><td><a href="operations/width-and-height">Width and height</a></td><td><mark style="color:orange;"><strong>width=X</strong></mark></td><td>sets the image width to X pixels</td></tr><tr><td><a href="operations/width-and-height">Width and height </a></td><td><mark style="color:orange;"><strong>height=X</strong></mark></td><td>sets the image height to X pixels</td></tr><tr><td><a href="operations/prevent-enlargement">Prevent enlargement</a></td><td><mark style="color:orange;"><strong>org_if_sml=1</strong></mark></td><td>prevents resizing if the target size is larger than the origin image</td></tr><tr><td><a href="operations/crop">Crop</a></td><td><mark style="color:orange;"><strong>func=crop</strong></mark></td><td>sets <em>crop</em> resize function</td></tr><tr><td><a href="broken-reference">Gravity crop</a></td><td><mark style="color:orange;"><strong>gravity=X</strong></mark></td><td>defines the part of the image to be retained when cropping<br>X = [north | south][east | west] | auto | X,Y</td></tr><tr><td><a href="operations/crop/positionable-crop">Positionable crop</a></td><td><mark style="color:orange;"><strong>tl_px=X,Y</strong></mark></td><td>sets coordinates of the top left corner of the cropping rectangle</td></tr><tr><td><a href="operations/crop/positionable-crop">Positionable crop</a></td><td><mark style="color:orange;"><strong>br_px=X,Y</strong></mark></td><td>sets coordinates of the bottom right corner of the cropping rectangle</td></tr><tr><td><a href="operations/crop/face-crop">Face crop</a></td><td><mark style="color:orange;"><strong>func=face</strong></mark></td><td>crops the image automatically focusing on the most prominent face</td></tr><tr><td><a href="operations/fit">Fit</a></td><td><mark style="color:orange;"><strong>func=fit</strong></mark></td><td>sets <em>fit</em> resize function</td></tr><tr><td><a href="operations/cropfit">Cropfit</a></td><td><mark style="color:orange;"><strong>func=cropfit</strong></mark></td><td>sets <em>crop</em> or <em>fit</em> resize function depending on the origin and the desired dimensions</td></tr><tr><td><a href="operations/bound">Bound</a></td><td><mark style="color:orange;"><strong>func=bound</strong></mark></td><td>sets <em>bound</em> resize function</td></tr><tr><td><a href="operations/boundmin">Boundmin</a></td><td><mark style="color:orange;"><strong>func=boundmin</strong></mark></td><td>bounds the image to the larger dimension</td></tr><tr><td><a href="operations/cover">Cover</a></td><td><mark style="color:orange;"><strong>func=cover</strong></mark></td><td>sets <em>cover</em> resize function (distorts image proportions)</td></tr><tr><td><a href="operations/flip">Flip</a></td><td><mark style="color:orange;"><strong>flip=[h][v]</strong></mark></td><td>mirrors the image horizontally and/or vertically</td></tr><tr><td><a href="operations/rotate">Rotate</a></td><td><mark style="color:orange;"><strong>r=X</strong></mark></td><td>rotates the image to X degrees (counterclockwise)</td></tr><tr><td><a href="operations/trim">Trim</a></td><td><mark style="color:orange;"><strong>trim=X</strong></mark></td><td>trims any solid-color border (if present); X is the aggressiveness of the operation</td></tr><tr><td><a href="operations/rounded-corners">Rounded corners</a></td><td><mark style="color:orange;"><strong>radius=X</strong></mark></td><td>applies rounded corners and optionally fills the empty background with a color</td></tr></tbody></table>

{% hint style="info" %}
Do not hesitate to[ contact us](https://www.scaleflex.com/contact-us) if you need any additional operations not listed above
{% endhint %}

## Resize functions <a href="#od_8cd351ba" id="od_8cd351ba"></a>

When you specify both width and height, original image proportions can be either ignored or maintained. Also, you may choose to add padding to the image to fill the blank space.&#x20;

Filerobot supports the following resize function (operation <mark style="color:orange;">**func**</mark>).

### Crop

Keeps image proportions cutting the image to fit the defined width and height

{% hint style="warning" %}
This resizing function removes parts of the image and is the default behaviour when both **width** and **height** are defined. Read further for other resizing functions.
{% endhint %}

| Preview                                                                                                                                                                                                             | Syntax                                                                                                                                                                                                                           |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2FVJmGx7aVcMY0Gc1Zka5m%2Fimage.png?alt=media\&token=d0b806c9-f533-456d-8be0-1c067114636b) | [/docs/hotel.jpg?<mark style="color:orange;">**w=400**</mark>&<mark style="color:orange;">**h=200**</mark>&<mark style="color:orange;">**func=crop**</mark>](https://fdocs.filerobot.com/docs/hotel.jpg?w=400\&h=200\&func=crop) |

### Fit

Resizes the image keeping proportions and adding padding to satisfy the desired dimensions

| Preview                                                                                                                                                                                                             | Syntax                                                                                                                                                                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2FiYGzZHfIoFrbZxSv81RT%2Fimage.png?alt=media\&token=00a108f5-5a93-4b90-b0dd-bc86570d68c7) | [/docs/hotel.jpg?<mark style="color:orange;">**w=400**</mark>&<mark style="color:orange;">**h=200**</mark>&<mark style="color:orange;">**func=fit**</mark>&<mark style="color:orange;">**bg\_color=000**</mark>](https://fdocs.filerobot.com/docs/hotel.jpg?w=400\&h=200\&func=fit\&bg_color=000) |

### Cropfit

Performs either [#crop](#crop "mention")or [#fit](#fit "mention") based on image dimensions and transformation parameters

{% hint style="warning" %}
This resizing function may remove parts of the image
{% endhint %}

| Preview                                                                                                                                                                                                             | Syntax                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2FMDviJNbjrA0Zzm47JITd%2Fimage.png?alt=media\&token=82115b66-20f5-4a14-8e2e-20dcc40903cc) | <p>650x500 origin image, cropped:<br><a href="https://fdocs.filerobot.com/docs/classroom.jpg?func=cropfit&#x26;w=500&#x26;h=350&#x26;bg_colour=auto">/docs/classroom.jpg?<mark style="color:orange;"><strong>func=cropfit</strong></mark>&<mark style="color:orange;"><strong>w=500</strong></mark>&<mark style="color:orange;"><strong>h=350</strong></mark>&<mark style="color:orange;"><strong>bg\_colour=auto</strong></mark></a></p>    |
| ![](https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2FT21Cs4FQLXBfu01ruA2S%2Fimage.png?alt=media\&token=6b7f9c7a-a7f2-4158-aa22-2ac25e7fe2be) | <p>Same parameters, 400x250 origin image:<br><a href="https://fdocs.filerobot.com/docs/ny_doc.jpg?func=cropfit&#x26;w=500&#x26;h=350&#x26;bg_colour=auto">/docs/ny\_doc.jpg?<mark style="color:orange;"><strong>func=cropfit</strong></mark>&<mark style="color:orange;"><strong>w=500</strong></mark>&<mark style="color:orange;"><strong>h=350</strong></mark>&<mark style="color:orange;"><strong>bg\_colour=auto</strong></mark></a></p> |

### Bound

Fits image in a box of defined size without adding padding

| Preview                                                                                                                                                                                                             | Syntax                                                                                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2F3VoVwROlWCmkAeM4O3zH%2Fimage.png?alt=media\&token=f6470ec7-5e9a-4e7e-9c59-1bd7cc377ab1) | [/docs/hotel.jpg?<mark style="color:orange;">**w=400**</mark>&<mark style="color:orange;">**h=200**</mark>&<mark style="color:orange;">**func=bound**</mark>](https://fdocs.filerobot.com/docs/hotel.jpg?w=400\&h=200\&func=bound) |

{% hint style="info" %}
The **boundmin** operation is a special case of bound where the smaller dimension is respected instead of the larger one
{% endhint %}

### Cover

Resizes the image to the given width and height ignoring original image proportions, thus distorting the image

| Preview                                                                                                                                                                                                             | Syntax                                                                                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2FMNcTgMTNaZOH6ezS2fdo%2Fimage.png?alt=media\&token=ac7cee58-b14c-49e4-9eb7-9570ed4c38a1) | [/docs/hotel.jpg?<mark style="color:orange;">**w=400**</mark>&<mark style="color:orange;">**h=250**</mark>&<mark style="color:orange;">**func=cover**</mark>](https://fdocs.filerobot.com/docs/hotel.jpg?w=400\&h=250\&func=cover) |

{% hint style="info" %}
For troubleshooting purposes, use the **ci\_info=1** operation to view details about resizing and compression, for example: [/docs/hotel.jpg?<mark style="color:orange;">**w=400**</mark>&<mark style="color:orange;">**ci\_info=1**</mark>](https://fdocs.filerobot.com/docs/hotel.jpg?w=400\&ci_info=1)
{% endhint %}
