# `FrenchCurve.Png`
[🔗](https://github.com/jaman/french_curve/blob/v0.1.4/lib/french_curve/png.ex#L1)

Encodes raw RGBA pixels as a PNG.

Only what `FrenchCurve.Backend.Iterm2` needs to wrap a raster in the one image format
iTerm2's inline-image protocol accepts. Encoding only; there is no decoder.

    png = FrenchCurve.Png.encode(width, height, FrenchCurve.Raster.to_rgba_binary(raster))

# `encode`

```elixir
@spec encode(pos_integer(), pos_integer(), binary()) :: binary()
```

Encodes a dense RGBA buffer as a complete PNG binary.

`rgba` must be exactly `width * height * 4` bytes, four bytes per pixel in red, green,
blue, alpha order and rows top to bottom; a mismatched size raises `FunctionClauseError`,
as do non-positive dimensions.

The result is an 8-bit-per-channel truecolour-with-alpha PNG whose scanlines all use
filter type 0 and whose pixel data sits in a single `IDAT` chunk deflated at the fastest
level.

---

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