Experimental Elixir bindings to libvips for image processing, since it's supposed to be faster than GraphicsMagick/ImageMagick. It is based on the existing Rust bindings to libVips. To make it work you will require libVips. Please refer to Dockerfile for dependencies.
Full documentation can be found at https://hexdocs.pm/elxvips.
import Elxvips
from_file( "image.png" )
|> resize( height: 100 )
|> jpg( strip: true )
|> to_file( "output.jpg" )
{ :ok, %ImageFile{} }
The package can be installed by adding elxvips
to your list of dependencies in mix.exs
:
def deps do
[
{:elxvips, "~> 0.1.4"}
]
end
Since version 0.1.3
Elxvips comes with some precompiled nifs, and depends only on libvips.
brew install vips llvm
apt install libvips
In case you require to compile the nifs from source, you would need to install rust and pkg-config.
# install rust if not already installed
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# install rust if not already installed
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
apt install rustc clang