> For the complete documentation index, see [llms.txt](https://docs.scaleflex.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scaleflex.com/dynamic-media-optimization-dmo/transformations/image-optimization/operations/crop/focal-point-crop.md).

# Focal point Crop

Setting crop gravity with focal point coordinates

Allows to crop an image by defining the coordinates of the crop focal point. It is useful when you want to crop images where the coordinates of the point of interest are already known.

To set the coordinates of the focal point, use the **gravity=X,Y** operation where **X** and **Y** are the coordinates of the focal point (in pixels). Alternatively, you can set the coordinates as a percentage of the original image - **gravity=Xp,Yp** or **gravity=xc,yc**, where X,Y=0..100 and x,y=0..1.

<mark style="color:orange;">**gravity=X,Y**</mark>

<mark style="color:orange;">**gravity=Xp,Yp|xc,yc**</mark>

Another way to set the coordinates is to save them as part of the `file info` metadata in the asset library and use the **gravity=meta** operation.

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

{% hint style="info" %}
**gravity=meta** will use the coordinates if present, and fall-back to **auto** if not.
{% endhint %}

All images having a custom focus point defined in the library, as a metadata associated to the the image) will use this as the `focal point crop`. If there is no `focus point` defined in the image metadata, **gravity=meta** falls back to **gravity=auto**.

## Examples

Original image: [/docs/castle.jpg?<mark style="color:orange;">**w=1000**</mark>](https://fdocs.filerobot.com/docs/castle.jpg?w=1000)

<figure><img src="https://fdocs.filerobot.com/docs/castle.jpg?w=1000" alt=""><figcaption></figcaption></figure>

| Preview                                                                                                                                                                                                             | Syntax                                                                                                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2FFvLSnEP4CBuPjcUHzL3a%2Fimage.png?alt=media\&token=a0a73a0a-d059-43d8-9c72-07d79b63a041) | [/docs/castle.jpg?<mark style="color:orange;">**w=450**</mark>&<mark style="color:orange;">**h=300**</mark>&<mark style="color:orange;">**gravity=1750,1000**</mark>](https://fdocs.filerobot.com/docs/castle.jpg?w=450\&h=300\&gravity=1750,1000) |
| ![](https://2536208400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqsq2dR7Fjagf5eTifWZx%2Fuploads%2Fojx2Rnx5soU58dHt9n7b%2Fimage.png?alt=media\&token=d0951845-4598-43c8-b02d-89861702f384) | [/docs/castle.jpg?<mark style="color:orange;">**w=450**</mark>&<mark style="color:orange;">**h=300**</mark>&<mark style="color:orange;">**gravity=80p,50p**</mark>](https://fdocs.filerobot.com/docs/castle.jpg?w=450\&h=300\&gravity=80p,50p)     |

{% hint style="info" %}
Please note that the focal point in **gravity=X,Y** has to be defined as coordinates **X** and **Y** of the full-sized origin image and not the scaled-down version.
{% endhint %}
