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

Parses an [ImageKit transform string](https://imagekit.io/docs/transformations)
into a canonical `Image.Plug.Pipeline`.

ImageKit's transform vocabulary is medium-sized (~50 keys). v0.1
implements the common subset that maps cleanly onto the canonical
IR:

* Sizing: `w`, `h`, `dpr`, `c` / `cm` (crop mode), `fo` (focus =
  gravity), `x` / `y` (focal point — derived together with
  `fo-custom` or `fo-xy_center`).

* Output: `q`, `f`.

* Effects: `bg` (background), `e-blur`, `e-sharpen`, `e-contrast`,
  `e-grayscale`, `e-usm` (unsharp mask).

* Geometry: `rt` (rotate, multiples of 90), `b` (border
  `b-<W>-<color>`).

* Overlays: `oi` (overlay-image base form).

Multiple chained transform stages (`tr:w-200:rt-90`) are flattened
to a single comma-joined list by the URL recogniser. The canonical
IR doesn't model chained transforms in v0.1, so order-dependent
multi-stage recipes collapse to last-write-wins. Documented in
`guides/image_kit_conformance.md`.

ImageKit-only features that don't fit the canonical IR
(`e-shadow`, `e-gradient`, AI tags) raise `:unsupported_option`.

# `parse`

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

Parses an ImageKit transform string into an `Image.Plug.Pipeline`.

### Arguments

* `transform_string` — the comma-joined transform string emitted
  by `Image.Plug.Provider.ImageKit.URL` (multiple stages already
  flattened to one comma-separated list).

* `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.ImageKit.Options
    iex> {:ok, pipeline} = Options.parse("w-200,c-extract,f-webp,q-80")
    iex> [resize] = pipeline.ops
    iex> {resize.width, resize.fit}
    {200, :crop}
    iex> pipeline.output.type
    :webp

---

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