Skip to content

Image processing in Elixir with NIF Bindings to libvips through rustler

Notifications You must be signed in to change notification settings

dpostolachi/elxvips

Repository files navigation

Elxvips

Build Status

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.

Documentation

Full documentation can be found at https://hexdocs.pm/elxvips.

Example

import Elxvips

from_file( "image.png" )
|> resize( height: 100 )
|> jpg( strip: true )
|> to_file( "output.jpg" )
{ :ok, %ImageFile{} }

Installation

The package can be installed by adding elxvips to your list of dependencies in mix.exs:

def deps do
  [
    {:elxvips, "~> 0.1.3"}
  ]
end

Precompiled NIFs

Since version 0.1.3 Elxvips comes with some precompiled nifs, and depends only on libvips.

Installing libvips

MacOS

brew install vips llvm

Ubuntu/Debian

apt install libvips

Install build dependencies

In case you require to compile the nifs from source, you would need to install rust and pkg-config.

MacOS

# install rust if not already installed
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Ubuntu/Debian

# install rust if not already installed
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

apt install rustc clang

About

Image processing in Elixir with NIF Bindings to libvips through rustler

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages