A Lightweight & Fast WebP Thumbnail Image Generator
Summary
Types
Functions
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 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
qualityandtarget_sizeoptions 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)