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

Parses an [imgix](https://docs.imgix.com/en/latest/apis/rendering)
query string into a canonical `Image.Plug.Pipeline`.

Imgix exposes ~80 documented parameters. v0.1 implements the
common subset that maps cleanly onto the canonical IR:

* Sizing: `w`, `h`, `dpr`, `fit`, `crop`, `fp-x`, `fp-y`.

* Output: `q`, `fm`, `auto` (multi-value `format,compress`).

* Effects: `bg`, `blur`, `sharp`, `bri`, `con`, `sat`, `gam`.

* Geometry: `flip`, `rot`, `trim`, `trimcolor`, `border`.

* Overlays: `mark`, `mark-w`, `mark-h`, `mark-x`, `mark-y`,
  `mark-fit`, `mark-rot`.

* Signing: `s`, `expires` — handled by
  `Image.Plug.Provider.Imgix.Signing`, not here.

Unknown keys raise `:unknown_option` by default; pass
`strict?: false` to log and ignore.

Custom-ICC colourspaces (`cs=adobergb1998`, `cs=appleRGB`, etc.)
return `:unsupported_option` — the parser does not synthesise
those from URL strings. Construct an `Ops.IccTransform{profile,
intent}` op directly, or wire an application-level alias map.
See `guides/imgix_conformance.md` for the per-option matrix.

# `parse`

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

Parses an imgix query string into an `Image.Plug.Pipeline`.

### Arguments

* `query_string` — the raw query string (no leading `?`).

* `parser_options` — keyword list. `:strict?` (default `true`)
  controls whether unknown keys raise.

### Returns

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

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

### Examples

    iex> alias Image.Plug.Provider.Imgix.Options
    iex> {:ok, pipeline} = Options.parse("w=200&fit=crop&fm=webp&q=80")
    iex> [resize] = pipeline.ops
    iex> {resize.width, resize.fit}
    {200, :cover}
    iex> pipeline.output.type
    :webp

---

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