# `FrenchCurve.Deflate`
[🔗](https://github.com/jaman/french_curve/blob/v0.2.0/lib/french_curve/deflate.ex#L1)

Compresses a picture into the zlib format a terminal expects, with libdeflate where it
is built and `:zlib` where it is not.

    FrenchCurve.Deflate.compress(pixels)
    FrenchCurve.Deflate.compress(pixels, 6)

The kitty graphics protocol takes its payload deflated and marked `o=z`, which means
the zlib wrapper of RFC 1950 rather than a bare deflate stream. Both paths here
produce that, so a terminal cannot tell them apart; they differ only in how long they
take and how small they get.

`level` runs `1` to `12` for libdeflate and is clamped to `1..9` for `:zlib`, which has
no levels above nine. Higher is smaller and slower. The default, `6`, is what
`:zlib.compress/1` uses.

`available?/0` says whether libdeflate is in use.

# `available?`

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

Whether libdeflate is built and loaded.

# `compress`

```elixir
@spec compress(binary(), 1..12) :: binary()
```

`data` compressed into the zlib format, at `level`.

---

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