View Source Thumbnailing

Basic code:

iex> original_raw = File.read!("/path/to_original.jpg"); nil
nil
iex> {:ok, original} = Image.from_binary(original_raw)
{:ok, %Vix.Vips.Image{ref: #Reference<0.4099923103.164495390.164069>}}
iex> {:ok, thumbnail} = Image.thumbnail(original, 200)
{:ok, %Vix.Vips.Image{ref: #Reference<0.4099923103.164495390.164078>}}
iex> Image.write(thumbnail, "/tmp/thumbnail.png")
{:ok, %Vix.Vips.Image{ref: #Reference<0.4099923103.164495390.164078>}}
iex> Image.write(thumbnail, "/path/to_thumbnail.png")
{:ok, %Vix.Vips.Image{ref: #Reference<0.4099923103.164495390.164078>}}

Examples:

Image.thumbnail/3
Image.thumbnail(image, 200, crop: :none)
Image.thumbnail/3
Image.thumbnail(image, 200, crop: :attention)
Image.crop/5
Image.crop!(image, 550, 320, 200, 200)
Image.rounded/2
image |> Image.thumbnail!(200, crop: :attention) |> Image.rounded!()
Image.squircle/2
image |> Image.thumbnail!(200, crop: :attention) |> Image.squircle!()
Image.avatar/3
Image.avatar(image, 200)