# `ExifOrientation`

How a stored photo must be turned to look upright, as a camera records it.

Use it to display or process photos. `top_left` is `1`, which needs no turning.

## Shape

One of these 8 values:

| Value | Written |
|---|---|
| `ExifOrientation.top_left` | `1` |
| `ExifOrientation.top_right` | `2` |
| `ExifOrientation.bottom_right` | `3` |
| `ExifOrientation.bottom_left` | `4` |
| `ExifOrientation.left_top` | `5` |
| `ExifOrientation.right_top` | `6` |
| `ExifOrientation.right_bottom` | `7` |
| `ExifOrientation.left_bottom` | `8` |

## Example

```jadpo
ExifOrientation.right_top
```

`text.parse(raw, as: ExifOrientation)` reads one from text that comes from outside. Text that isn't one at all fails `malformed`, such as `0`, `9` or `06`.

## Good to know

- It is written as the number a camera records, from `1` to `8`.
- `==` tells you whether two are the same. `<` and `list.sort_by` don't take it.

## In JSON

A string, in a request, a response or `json.write`:

```json
"1"
"6"
"8"
```

## Details

<details>
<summary>Text form, storage, how it is shown, and operations</summary>

`ExifOrientation` is in the group Media and visual, and has been in Jadpo since 0.1.0.

### Text form

`text.from` writes one standard text form, the same form `text.parse` reads back: `1`, `6` and `8`.

### How it is stored

It is stored in one column named for the field, of type `text`. `6` is stored as `'6'`.

### How it is shown to people

`text.format(value, locale:)` shows it to people in their locale.

With `locale: Locale.en_gb`:

| Value | Shown |
|---|---|
| `1` | `1` |
| `6` | `6` |
| `8` | `8` |

### Operations

It also takes `text.parse`, `text.from`, `text.format`, `json.read`, `json.write` and `==`. [How every standard type behaves](/docs/every-standard-type-meets-one-contract.md) says how they work.

</details>
