Skip to content

Commit

Permalink
Merge pull request #132 from nathanl/expand_example
Browse files Browse the repository at this point in the history
Expand example on thumbnailing
  • Loading branch information
kipcole9 authored Mar 20, 2024
2 parents 799065a + 2026716 commit 67e78e6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions guides/thumbnailing.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@
}
</style>

Basic code:

```elixir
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:

<div class="row">
<div class="column">
<figure>
Expand Down

0 comments on commit 67e78e6

Please sign in to comment.