# `Rasterling`
[🔗](https://github.com/thestonefox/rasterling/blob/main/lib/rasterling.ex#L1)

Decodes PNG, baseline/progressive JPEG, the first GIF frame, and BMP on the BEAM.

No third-party NIFs, executables, network requests or runtime dependencies.
Standard OTP `:zlib` decompresses PNG data. Output is eight-bit RGBA.

# `decode`

```elixir
@spec decode(binary(), keyword()) ::
  {:ok, Rasterling.Image.t()} | {:error, Rasterling.Error.t()}
```

Decodes encoded bytes into `{:ok, image}` or `{:error, %Rasterling.Error{}}`.

Options: `:max_bytes`, `:max_pixels`, `:timeout` (milliseconds) and
`:max_memory_bytes` (worker heap budget). All must be positive integers.
The GC-checked worker budget includes shared reference-counted binaries.
It is not a process RSS or VM-wide memory guarantee.

# `decode!`

Like `decode/2`, but raises `Rasterling.Error` on failure.

# `open`

Reads at most `:max_bytes + 1` bytes from a local file, then decodes them.

---

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