> For the complete documentation index, see [llms.txt](https://docs.cloudimage.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloudimage.io/transformations/image-operations/crop/automatic-gravity-crop.md).

# Automatic gravity crop

Chooses the most important image features and objects and sets the focal point on them when cropping.

<mark style="color:orange;">**gravity=smart**</mark>

<mark style="color:orange;">**gravity=auto**</mark>

<mark style="color:orange;">**gravity=face**</mark>

## Smart gravity

Sets the crop focal point on the people in the image or on the most prominent features if no faces are detected. Useful for creating thumbnails from images with different aspect ratios.

### Examples

| Preview                          | Syntax                                                                                                                                                                                                                                                                                 |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](/files/dYgrJzhHo82xiPV5HJmd) | [/samples.scaleflex.com/mountains.jpg?<mark style="color:orange;">**w=300**</mark>](https://doc.cloudimg.io/https://samples.scaleflex.com/mountains.jpg?w=300)                                                                                                                         |
| ![](/files/8l085gVnb5YXqJliJ3w4) | [/samples.scaleflex.com/mountains.jpg?<mark style="color:orange;">**h=300**</mark>&<mark style="color:orange;">**w=300**</mark>&<mark style="color:orange;">**gravity=smart**</mark>](https://doc.cloudimg.io/https://samples.scaleflex.com/mountains.jpg?h=300\&w=300\&gravity=smart) |
| ![](/files/BecCkY5Gtjj0v5liiq2N) | [/samples.scaleflex.com/hotel.jpg?<mark style="color:orange;">**h=300**</mark>](https://doc.cloudimg.io/https://samples.scaleflex.com/hotel.jpg?h=300)                                                                                                                                 |
| ![](/files/d5QyY3VbesVLR8QmeAfZ) | [/samples.scaleflex.com/hotel.jpg?<mark style="color:orange;">**h=300**</mark>&<mark style="color:orange;">**w=300**</mark>&<mark style="color:orange;">**gravity=smart**</mark>](https://doc.cloudimg.io/https://samples.scaleflex.com/hotel.jpg?h=300\&w=300\&gravity=smart)         |

## Automatic gravity

Setting the **gravity** parameter to **auto** finds the focal point of the image based on entropy.

### Examples

| Preview                          | Syntax                                                                                                                                                                                                                                                                     |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](/files/4RNiaFbDxAVs7bUqQn2u) | [/samples.scaleflex.com/boat.jpg?<mark style="color:orange;">**h=300**</mark>](https://doc.cloudimg.io/https://samples.scaleflex.com/boat.jpg?h=300)                                                                                                                       |
| ![](/files/I5mIbAB861lrZ53VTe8l) | [/samples.scaleflex.com/boat.jpg?<mark style="color:orange;">**h=300**</mark>&<mark style="color:orange;">**w=300**</mark>&<mark style="color:orange;">**gravity=auto**</mark>](https://doc.cloudimg.io/https://samples.scaleflex.com/boat.jpg?h=300\&w=300\&gravity=auto) |

## Face gravity

When using **gravity=face**, all images with one dominant face are focused on this face upon cropping. If there are many or no faces in the image, **gravity** falls back to **auto**.

{% hint style="info" %}
If you would like to try and include multiple faces in the image, you can use **gravity=smart**
{% endhint %}

### Examples

| Preview                          | Syntax                                                                                                                                                                                                                                                                               |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ![](/files/fiNHLAmbFCdmIsApv5q6) | [/samples.scaleflex.com/classroom.jpg?<mark style="color:orange;">**h=300**</mark>&<mark style="color:orange;">**w=300**</mark>&<mark style="color:orange;">**gravity=face**</mark>](https://doc.cloudimg.io/https://samples.scaleflex.com/classroom.jpg?h=300\&w=300\&gravity=face) |


---

# 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.cloudimage.io/transformations/image-operations/crop/automatic-gravity-crop.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.
