# Resize Strategies

The examples below show how the `resize_strategy` impacts resizing a 400×300 pixel image to 100×100 pixels:

### `fit`

Uses the **larger** side of the original image as a base for the resize. Aspect ratio is preserved. Either side will become at most 100 pixels.

For example: resizing a 400×300 image into 100×100, would produce a 100×75 image.

##### Before:

![The fit resize strategy keeps the full image within 100 by 100 pixels](https://demos.transloadit.com/77/de8c86ef27492ebdfe2340ea6331de/desert-small.jpg)

Larger side

desert-small.jpg

21 KB ⋅ 400×300

##### After:

![The fit resize strategy keeps the full image within 100 by 100 pixels](https://demos.transloadit.com/89/0773178b6d41fda6971c74d7ac6426/desert-small.jpg)

100 px

desert-small.jpg

3.1 KB ⋅ 100×75

### `fillcrop`

Scales the image to fit into our 100×100 target while preserving aspect ratio, while trimming away any excess surface. This means both sides will become exactly 100 pixels, at the tradeoff of destroying parts of the image.

By default the resulting image is horizontally/vertically centered to fill the target rectangle. Use the `gravity` parameter to change where to crop the image, such as `"bottom"` or `"left"`.

##### Before:

![The fillcrop resize strategy fills a 100 by 100 pixel square and crops the excess](https://demos.transloadit.com/77/de8c86ef27492ebdfe2340ea6331de/desert-small.jpg)

desert-small.jpg

21 KB ⋅ 400×300

##### After:

![The fillcrop resize strategy fills a 100 by 100 pixel square and crops the excess](https://demos.transloadit.com/9b/835c247f1b4f80bfebd96ea3d1ab9c/desert-small.jpg)

desert-small.jpg

3.9 KB ⋅ 100×100

### `min_fit`

Uses the **smaller** side of the original image as a base for the resize. After resizing, the larger side will have a larger value than specified. Aspect ratio is preserved. Either side will become at least 100 pixels.

For example: resizing a 400×300 image into 100×100, would produce a 133×100 image.

##### Before:

![The min\_fit resize strategy keeps both image dimensions at least 100 pixels](https://demos.transloadit.com/77/de8c86ef27492ebdfe2340ea6331de/desert-small.jpg)

Smaller side

desert-small.jpg

21 KB ⋅ 400×300

##### After:

![The min\_fit resize strategy keeps both image dimensions at least 100 pixels](https://demos.transloadit.com/34/d5b63ec5a044fdb7e2d13b18e07d6c/desert-small.jpg)

100 px

desert-small.jpg

4.6 KB ⋅ 133×100

### `pad`

Scales the image to fit while preserving aspect ratio. Both sides of the resized image become exactly 100 pixels, and any remaining surface is filled with a background color.

In this example, the background color is determined by the[Assembly Variable](/docs/topics/assembly-instructions.md#assembly-variables) `${file.meta.average_color}`. If you set `zoom` to `false` (default is `true`), smaller images will be centered horizontally and vertically, and have the background padding all around them.

##### Before:

![The pad resize strategy adds background color to create a 100 by 100 pixel image](https://demos.transloadit.com/77/de8c86ef27492ebdfe2340ea6331de/desert-small.jpg)

desert-small.jpg

21 KB ⋅ 400×300

##### After:

![The pad resize strategy adds background color to create a 100 by 100 pixel image](https://demos.transloadit.com/a5/8b87822c454c5092cfa82d3eb3df11/desert-small.jpg)

desert-small.jpg

3.4 KB ⋅ 100×100

### `stretch`

Ignores aspect ratio, resizing the image to the exact width and height specified. This may result in a stretched or distorted image.

##### Before:

![The stretch resize strategy distorts the image to exactly 100 by 100 pixels](https://demos.transloadit.com/77/de8c86ef27492ebdfe2340ea6331de/desert-small.jpg)

desert-small.jpg

21 KB ⋅ 400×300

##### After:

![The stretch resize strategy distorts the image to exactly 100 by 100 pixels](https://demos.transloadit.com/db/40e0c7367e4cd6be2c47a0a235a56d/desert-small.jpg)

desert-small.jpg

3.8 KB ⋅ 100×100

### `crop`

Cuts an area out of an image, discarding any overlapping parts. If the source image is smaller than the crop frame, it will be zoomed. This strategy is implied when you specify coordinates in the`crop` parameter, and cannot be used without it.

To crop around human faces, see[🤖/image/facedetect](/docs/robots/image-facedetect.md) instead.

##### Before:

![The crop resize strategy cuts a 100 by 100 pixel area from the image](https://demos.transloadit.com/77/de8c86ef27492ebdfe2340ea6331de/desert-small.jpg)

desert-small.jpg

21 KB ⋅ 400×300

##### After:

![The crop resize strategy cuts a 100 by 100 pixel area from the image](https://demos.transloadit.com/97/4d8ba623cc49d588a81baa1247a3a6/desert-small.jpg)

desert-small.jpg

2.8 KB ⋅ 100×100
