| 1 |
--- |
| 2 |
title: images.AutoOrient |
| 3 |
description: Returns an image filter that rotates and flips an image as needed per its Exif orientation tag. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
aliases: [] |
| 9 |
returnType: images.filter |
| 10 |
signatures: [images.AutoOrient] |
| 11 |
--- |
| 12 |
|
| 13 |
## Usage |
| 14 |
|
| 15 |
Create the filter: |
| 16 |
|
| 17 |
```go-html-template |
| 18 |
{{ $filter := images.AutoOrient }} |
| 19 |
``` |
| 20 |
|
| 21 |
{{% include "/_common/functions/images/apply-image-filter.md" %}} |
| 22 |
|
| 23 |
> [!NOTE] |
| 24 |
> When using with other filters, specify `images.AutoOrient` first. |
| 25 |
|
| 26 |
```go-html-template |
| 27 |
{{ $filters := slice |
| 28 |
images.AutoOrient |
| 29 |
(images.Process "resize 200x") |
| 30 |
}} |
| 31 |
{{ with resources.Get "images/original.jpg" }} |
| 32 |
{{ with images.Filter $filters . }} |
| 33 |
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt=""> |
| 34 |
{{ end }} |
| 35 |
{{ end }} |
| 36 |
``` |
| 37 |
|
| 38 |
## Example |
| 39 |
|
| 40 |
{{< img |
| 41 |
src="images/examples/landscape-exif-orientation-5.jpg" |
| 42 |
alt="Zion National Park" |
| 43 |
filter="AutoOrient" |
| 44 |
filterArgs="" |
| 45 |
example=true |
| 46 |
>}} |