Image is intended to provide well-documented, performant and reliable common image processing functions in an idiomatic Elixir functional style. It operates at a layer above the very comprehensive set of functions in
In a very simple image resizing benchmark,
Image is approximately 2 to 3 times faster than
Mogrify and uses about 5 times less memory.
Image is based upon
libvips it is performant, concurrent, pipelining and has a low memory footprint.
In this first release it focuses on resizing, cropping, masking, corner rounding, circular cropping, metadata extract, metadata minimisation. It also includes some simple functions to make it easy to resize and compress images for many well-known social media platforms at the correct size.
In the next two releases,
- Provide streamed image processing. That will allow an image to be streamed from a file, or from S3 or from any Elixir stream or enumerable, process the image and then stream its output - including to chunked responses for HTTP applications.
- Provide bi-directional Integration with Nx that will efficiently share memory buffers and make it even simpler to involve image processing in ML applications.
Resize to fitImage.resize(image, 200, crop: :none)
Resize to fillImage.resize(image, 200, crop: :attention)
Crop imageImage.crop!(image, 550, 320, 200, 200)
Rounded cornersimage |> Image.resize!(200, crop: :attention) |> Image.rounded!()
Avatar (circular mask, remove most metadata, crop to a subject of interest)Image.avatar(image, 200)