# `Thumbp`
[🔗](https://github.com/ryochin/thumbp/blob/v0.2.1/lib/thumbp.ex#L1)

A Lightweight & Fast WebP Thumbnail Image Generator

# `body`

```elixir
@type body() :: binary()
```

# `height`

```elixir
@type height() :: 1..16383
```

# `width`

```elixir
@type width() :: 1..16383
```

# `create`

```elixir
@spec create(body(), width(), height()) :: {:ok, binary()} | {:error, String.t()}
```

Create a thumbnail image.

`width` and `height` must be integers between 1 and 16383, the
maximum dimension the WebP format can represent.

## Examples

    iex> content = File.read!("./test/assets/images/sample.jpg")
    iex> Thumbp.create(content, 320, 240)
    {:ok, <<82, 73, 70, 70, 102, 12, 0, 0, 87, 69, 66, 80, ...>>}

# `create`

```elixir
@spec create(body(), width(), height(), keyword()) ::
  {:ok, binary()} | {:error, String.t()}
```

Create a thumbnail image with options.

## Options

- `quality` - Quality value from 0 to 100. Defaults to 60.
- `target_size` - Target size in bytes. Increases processing time by approximately 20-80%.
- `effort` - Encoding effort from 0 (fastest) to 6 (smallest file size). Defaults to 3.

> The `quality` and `target_size` options are mutually exclusive.

## Examples

    iex> content = File.read!("./test/assets/images/sample.jpg")
    iex> Thumbp.create(content, 320, 240, quality: 50)
    iex> Thumbp.create(content, 320, 240, target_size: 12_000)
    iex> Thumbp.create(content, 320, 240, effort: 5)

---

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