Parses an ImageKit transform string
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 withfo-customorfo-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(borderb-<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.
Summary
Functions
Parses an ImageKit transform string into an Image.Plug.Pipeline.
Functions
@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 byImage.Plug.Provider.ImageKit.URL(multiple stages already flattened to one comma-separated list).parser_options— keyword list.:strict?(defaulttrue) 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