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

Probes the local libvips build for optional encoder capabilities.

Run once at application boot. Results are cached in
`:persistent_term` so per-request reads are free.

Currently probes AVIF, JP2, and TIFF write support. Adding a
probe for another capability is one new clause in `probe/0` and
one new accessor.

# `avif_write?`

```elixir
@spec avif_write?() :: boolean()
```

Returns whether the local libvips can encode AVIF.

Falls back to a one-off probe if `probe/0` (in this module) has
not been called — useful in tests that exercise the encoder
without booting the application.

### Returns

* `true` if libvips can write AVIF.

* `false` otherwise.

### Examples

    iex> is_boolean(Image.Plug.Capabilities.avif_write?())
    true

# `jp2_write?`

```elixir
@spec jp2_write?() :: boolean()
```

Returns whether the local libvips can encode JPEG 2000 (JP2).

Required by IIIF Image API 3.0 Compliance Level 2 deployments
that promise JP2 support. Available only when libvips was built
with `libopenjp2`.

### Returns

* `true` if libvips can write JP2.

* `false` otherwise.

# `probe`

```elixir
@spec probe() :: :ok
```

Performs every capability probe and caches the results.

Idempotent: calling `probe/0` twice in the same VM lifetime returns
the same booleans without re-probing.

### Returns

* `:ok`.

# `tiff_write?`

```elixir
@spec tiff_write?() :: boolean()
```

Returns whether the local libvips can encode TIFF.

Required by IIIF Image API 3.0 Compliance Level 2 deployments
that promise TIFF support.

### Returns

* `true` if libvips can write TIFF.

* `false` otherwise.

---

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