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

Parses a [Cloudinary transform string](https://cloudinary.com/documentation/transformation_reference)
into a canonical `Image.Plug.Pipeline`.

Cloudinary's transform vocabulary is large (~100+ keys). v0.1
implements the common subset that maps cleanly onto the canonical
IR:

* Sizing: `w_`, `h_`, `dpr_`, `c_` (crop mode), `g_` (gravity),
  `x_` / `y_` (focal point — derived together with `g_xy_center`).

* Output: `q_`, `f_`.

* Effects: `b_` (background), `e_blur:`, `e_sharpen:`,
  `e_brightness:`, `e_contrast:`, `e_saturation:`, `e_gamma:`.

* Geometry: `a_` (rotate, multiples of 90), `e_grayscale` (treated
  as `Adjust{saturation: 0.0}`), `bo_` (border `bo_<W>px_solid_<color>`).

* Overlays: `l_<public-id>` (single-layer base form).

Multiple transform stages (`w_200,c_fill/e_blur:300/`) are
flattened by the URL recogniser into a single comma-joined string;
this parser then walks them as one set. The canonical IR doesn't
model chained transforms in v0.1, so order-dependent multi-stage
recipes (sharpen → resize → sharpen) collapse to last-write-wins.
This is documented in `guides/cloudinary_conformance.md`.

Cloudinary-only features that don't fit the canonical IR
(`e_vignette`, `e_pixelate`, `e_cartoonify`, `e_replace_color`,
`e_fade`, `cs_srgb`, named transformations `t_<name>`) raise
`:unsupported_option` so users learn early.

# `parse`

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

Parses a Cloudinary transform string into an `Image.Plug.Pipeline`.

### Arguments

* `transform_string` — the comma-joined transform string emitted
  by `Image.Plug.Provider.Cloudinary.URL` (multiple stages are
  pre-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.Cloudinary.Options
    iex> {:ok, pipeline} = Options.parse("w_200,c_fill,f_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*
