> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.templated.io/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Why Is My Image Cropped?

When the photo you send has a different shape than the image layer (for example a vertical portrait in a square frame), part of it is cropped. This is controlled by two layer settings, **Object Fit** and **Alignment**. Set them once on the layer and every image you send, larger or smaller than the frame, is placed the same way, so you don't need to crop photos by hand before rendering.

### Why it happens

Image layers use **Cover** by default. Cover fills the whole frame and crops whatever doesn't fit, equally on both sides. With a vertical portrait in a square frame, that means the top and the bottom are cut, which is why the top of a person's head can disappear.

### Keep the frame filled and choose what stays visible

Keep Cover and align the image to the part that matters. For photos of people, align to the top.

In the editor: select the image layer, open **Object Fit** in the top toolbar, keep **Cover**, pick the top under **Alignment** and save the template.

Through the API, send `object_position` on the layer:

```json
{
  "template": "YOUR_TEMPLATE_ID",
  "layers": {
    "photo": {
      "image_url": "https://example.com/portrait.jpg",
      "object_fit": "cover",
      "object_position": "top"
    }
  }
}
```

`object_position` accepts CSS values such as `"center"`, `"top"`, `"bottom left"` or percentages like `"50% 15%"` (horizontal, then vertical) for fine tuning.

### Show the whole image, never crop

Use **Contain**. The image is shown in full, and empty space is left on the sides or on the top and bottom when its shape differs from the frame.

```json
{
  "layers": {
    "photo": {
      "image_url": "https://example.com/portrait.jpg",
      "object_fit": "contain"
    }
  }
}
```

### Things to know

- `object_fit` accepts `cover`, `contain`, `fill` and `none`. `fill` stretches the image to the frame size and can distort it.
- Settings saved on the layer in the editor apply to every render, so you only need to send `object_fit` or `object_position` in the request when you want to override them.
- There is no automatic face detection or smart crop. Alignment is the way to keep faces in the frame.
- To crop a specific area of one image, use `crop_x`, `crop_y`, `crop_width` and `crop_height` (percentages from 0 to 100).
- All image layer parameters are listed in the [API documentation](https://templated.io/docs/renders/create/).