elixir-image / image

Image processing for Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for swappable backends? starting with a Rust-based one

mayel opened this issue · comments

I came across this crate and thought it may be cool if Image supported it as an alternative backend https://crates.io/crates/image (and not only because of the shared name ;)

A quick search turned up a writeup about using it as a NIF:
https://fly.io/phoenix-files/elixir-and-rust-is-a-good-mix/
and an old library doing so:
https://github.com/scrogson/mirage

Thoughts?

Its an interesting idea, but not one I'm likely to pursue for the following reasons:

  1. Compared to libvips, the Rust crate is quite limited in the operations it supports.
  2. One of the key values of libvips is that it is demand driven and horizontally threaded. This makes is more memory efficient for many app types (like web apps) and more scalable since its operations are threaded.
  3. Its structure is quite functional so it composes well, and composes well in Elixir. This is valuable because the high level operations can be expressed in Elixir and then there is only one NIF call that implements the operation. We get the expressiveness of Elixir and the performance and efficiency of libvips.

Did you see some benefits to the Rust crate that I missed?