Skip to content

Commit 7be33a2

Browse files
committed
Add crop_aspect_ratio docs
1 parent 97d3448 commit 7be33a2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/usage/processing.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,23 @@ Defines an area of the image to be processed (crop before resize).
296296
* When `width` or `height` is set to `0`, imgproxy will use the full width/height of the source image.
297297
* `gravity` _(optional)_ accepts the same values as the [gravity](#gravity) option. When `gravity` is not set, imgproxy will use the value of the [gravity](#gravity) option.
298298

299+
### Crop aspect ratio ((pro))
300+
301+
```imgproxy_url_option
302+
crop_aspect_ratio:%aspect_ratio:%enlarge
303+
crop_ar:%aspect_ratio:%enlarge
304+
car:%aspect_ratio:%enlarge
305+
```
306+
307+
Corrects the aspect ratio of the crop area defined with the [crop](#crop) processing option.
308+
309+
* `aspect_ratio` - the aspect ratio that the crop area should match. When set to `0`, imgproxy doesn't correct the crop area aspect ratio.
310+
* `enlarge` - when set to `1`, `t`, or `true`, imgproxy will enlarge the crop area when needed instead of reducing it. If any dimension of the enlarged crop area exceeds the image size, imgproxy will reduce the crop area to fit the image, maintaining the requested aspect ratio.
311+
312+
:::info
313+
This option only corrects the crop area size but doesn't correct the crop gravity. This means that if you use the following options – `crop:100:200:nowe:300:400/crop_ar:1.1` – imgproxy will crop the 300x400x200x200 area. If you want imgproxy to maintain the crop area center, use the `fp` [gravity](#gravity) instead.
314+
:::
315+
299316
### Trim
300317

301318
```imgproxy_url_option

0 commit comments

Comments
 (0)