> ## Documentation Index
> This page is part of the Image and Video APIs product. Fetch the complete documentation index for Image and Video APIs at: https://cloudinary.com/documentation/llms-image-and-video-apis.txt?referrer=docpage and then use it to discover all relevant pages before exploring further.
> If your task extends beyond this product, fetch the top-level index covering all Cloudinary products and topics at: https://cloudinary.com/documentation/llms.txt?referrer=docpage

# Gravity-based crops for images (video tutorial)

## Overview

Manually cropping individual images with graphic editing tools to maintain the focal point can be time-intensive. Cloudinary offers its machine-learning and AI-powered content-aware cropping as a solution to this problem. 

Let's introduce you to the different [gravity options](image_gravity#control_gravity), including hard-coded directional types, and a variety of automatic detection options.

## Video tutorial

  This video is brought to you by Cloudinary's video player - embed your own!Use the controls to set the playback speed, navigate to chapters of interest and select subtitles in your preferred language.
{videoTranscript:publicId=training/m-tutorial-apply-gravity-based-crops}

## Tutorial contents
This tutorial presents the following topics. Click a timestamp to jump to that part of the video.
### What is gravity-specific cropping?
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | By applying [the **gravity** transformation parameter](transformation_reference#g_gravity) for an image URL, you can instruct Cloudinary to automatically detect which part of the original image to retain, no matter what cropping, scaling or padding options are applied.
|

### Compass-direction cropping
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | [Compass-style directions](transformation_reference#g_compass_position) represent a location in the image. For example, `g_north_east` represents the top right corner, whereas `g_south_west` designates the bottom-left corner.

![Animated Example of Cloudinary Gravity Cropping Transformations Applied to Image of Eagles](https://res.cloudinary.com/demo/image/upload/c_scale,w_500/f_auto/q_auto/v1552491380/compass-directions-eagle_wvwe4t.gif "with_code:false, with_url:false")

### Content-aware cropping - facial detection
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | One way to create a more reusable cropping style is to have it locate interesting or important aspects in the image. For example, we may want to automatically crop on the most prominent face in a group. This can be done using `g_face`, thanks to [Cloudinary's facial recognition capabilities](face_detection_based_transformations#face_detection_based_cropping).

![Animated Example of Applying Cloudinary's g_face Transformation to an Image](https://res.cloudinary.com/demo/image/upload/c_scale,w_500/f_auto/q_auto/v1552511684/g_face_vfzowj.gif "with_code:false, with_url:false")

### Automatically crop to the most interesting area (g_auto)
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | You can also apply [Cloudinary's automatic gravity algorithm (g_auto)](image_automatic_gravity), which uses a combination of heuristics or deep learning algorithms to detect and display the most interesting aspect of the image.

![Before and After Example of an Image Using Cloudinary's g_auto Transformation](https://res.cloudinary.com/demo/image/upload/c_scale,w_500/f_auto/q_auto/v1552512204/g_auto-skater-beforeafter_albxqw.png "with_code:false, with_url:false")

### Use g_auto:subject on images
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | By training our neural networks with large datasets, we have created a way to determine the area of the image to which the human eye will be drawn. You can take advantage of this through the [g_auto:subject](image_automatic_gravity#selecting_a_single_automatic_gravity_algorithm) transformation, providing better crop results with very challenging content, such as images with multiple faces.

![Comparison of Cloudinary's g_auto:classic and g_auto:subject Transformations Using an Image of Two Bears](https://res.cloudinary.com/demo/image/upload/c_scale,w_500/f_auto/q_auto/v1552513428/g_auto-classic-g_auto-subject-comparison-bears_tafhnw.png "with_code:false, with_url:false")

### Crop to specific objects in an image
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | Rather than playing with compass-style directions or using our automatic cropping transformations, you can let Cloudinary detect the object with `g_auto:<object>`, for example `g_auto:cake`, using our [Cloudinary AI Content Analysis add-on](cloudinary_ai_content_analysis_addon#applying_object_aware_cropping). This transformation helps to ensure the object is kept when the image is cropped.

![Example of a Kitchen When Applying Cloudinary's g_auto:object on the Cake in the Image](https://res.cloudinary.com/demo/image/upload/c_scale,w_300/f_auto/q_auto/v1552514897/kitchen-g_auto_object-cake-example_gv9fww.jpg "with_code:false, with_url:false")

## Keep learning

> **READING**:
>
> * Review our documentation for more examples of Cloudinary's [gravity transformations](image_gravity#control_gravity) with images.

> * Find out how to [apply gravity transformations to your videos](video_resizing_and_cropping#control_gravity) with Cloudinary.

> * Take a look at the [User-generated content guide](user_generated_content) to see all the features you can take advantage of when displaying user-generated content on your site.

> * Enroll in [our introductory Cloudinary Academy courses](https://training.cloudinary.com/) that highlight ways to apply gravity transformations, such as [Fundamentals for Developers](https://training.cloudinary.com/courses/cloudinary-fundamentals-for-developers).

#### If you like this, you might also like...

[Named Transformations](named_transformations_tutorial)

Simplify & standardize complex delivery URLs

[Optimization Tips](optimization_tips_tutorial)

Tips for delivering optimized images

[Content-aware Video Cropping](content_aware_video_cropping_tutorial)

Smartly crop a video using content-aware AI

&nbsp;

&nbsp;Check out the Cloudinary Academy for free self-paced Cloudinary courses on a variety of developer or DAM topics, or register for formal instructor-led courses, either virtual or on-site.
&nbsp;
