# `VideoResolution`

A video's frame size in pixels: `1920x1080`.

Use it for video. Give the pixels, not a name like "4K". For a still image, use [`ImageDimensions`](/docs/types/type-image-dimensions.md).

## Shape

| Field | Type | Required? |
|---|---|---|
| `width` | `Int` | Yes |
| `height` | `Int` | Yes |

## Example

```jadpo
VideoResolution { width: 1920 height: 1080 }
```

`text.parse(raw, as: VideoResolution)` reads one from text that comes from outside. Text that isn't one at all fails `malformed`, such as `0x1080`, `1920x0` or `1920X1080`.

## Good to know

- `==` tells you whether two are the same. `<` and `list.sort_by` don't take it, so sort by one of its parts instead.

## In JSON

An object of its parts, in a request, a response or `json.write`:

```json
{"width":1280,"height":720}
{"width":1920,"height":1080}
{"width":3840,"height":2160}
```

## Details

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

`VideoResolution` 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: `1280x720`, `1920x1080` and `3840x2160`.

### How it is stored

It is stored in 2 columns, each named for the field, `_` and its suffix. This is `3840x2160`:

| Column | Type | Holds |
|---|---|---|
| `<field>_width` | `integer` | `3840` |
| `<field>_height` | `integer` | `2160` |

### How it is shown to people

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

With `locale: Locale.en_gb`:

| Value | Shown |
|---|---|
| `1280x720` | `1280x720` |
| `1920x1080` | `1920x1080` |
| `3840x2160` | `3840x2160` |
| `4096x2160` | `4096x2160` |

### 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>
