# `Image.Plug.Provider.IIIF.Options`
[🔗](https://github.com/elixir-image/image_plug/blob/v0.1.0/lib/image/plug/provider/iiif/options.ex#L1)

Parses the four IIIF Image API 3.0 option segments
(`region / size / rotation / quality.format`) into a canonical
`Image.Plug.Pipeline`.

Inverse of `Image.Components.URL.iiif/2`. Targets [Compliance Level
2](https://iiif.io/api/image/3.0/compliance/) of the Image API 3.0
specification.

Built incrementally over Phases 3b–3d:

* **3b** — region: `full` | `square` | `<x,y,w,h>` | `pct:<x,y,w,h>`.
* **3c** — size: `max` | `^max` | `<w>,` | `,<h>` | `<w>,<h>` |
  `!<w>,<h>` | `pct:<n>` plus `^` upscale prefixes.
* **3d** — rotation, quality, format.

# `parse`

```elixir
@spec parse(
  {String.t(), String.t(), String.t(), String.t()},
  keyword()
) :: {:ok, Image.Plug.Pipeline.t()} | {:error, Image.Plug.Error.t()}
```

Parses the four IIIF option segments into a `Pipeline`.

### Arguments

* `segments` is a `{region, size, rotation, quality_dot_format}`
  four-tuple of strings, exactly as produced by
  `Image.Plug.Provider.IIIF.URL.parse/2`.

* `parser_options` is a keyword list. `:strict?` (default `true`)
  rejects malformed segments; with `:strict?` set to `false`,
  unrecognised segments are reported with `Logger.warning/1` and
  treated as their respective no-op (`full` / `max` / `0` / `default`).

### Returns

* `{:ok, pipeline}` on success.

* `{:error, %Image.Plug.Error{}}` on the first malformed segment.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
