# `Image.Plug.Pipeline.Interpreter`
[🔗](https://github.com/elixir-image/image_plug/blob/v0.1.0/lib/image/plug/pipeline/interpreter.ex#L1)

Executes a normalised pipeline against an open `Vix.Vips.Image`.

The interpreter is a single `Enum.reduce_while/3` over the op list
with one `apply_op/2` clause per op kind. There is no implicit
reordering — `Image.Plug.Pipeline.Normaliser` runs first, so the
ops arrive in canonical order with no-ops already folded away.

# `execute`

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

Runs the pipeline.

### Arguments

* `pipeline` is a normalised `Image.Plug.Pipeline` struct.

* `image` is an open `Vix.Vips.Image`.

* `options` is a keyword list of context the interpreter may
  need for ops that reference external resources.

### Options

* `:resolve_layer_source` — a 1-arity function
  `fn %Image.Plug.Source{} -> {:ok, Vix.Vips.Image.t()} | {:error, term()} end`
  used by the `Image.Plug.Pipeline.Ops.Draw` clause to fetch
  overlay images. The plug passes a closure over its configured
  `Image.Plug.SourceResolver`. If omitted and a Draw op is
  encountered, the interpreter returns `:invalid_option`.

### Returns

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

* `{:error, %Image.Plug.Error{}}` on the first failed op.

---

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