Skip to content

Latest commit

 

History

History
50 lines (35 loc) · 1.14 KB

README.md

File metadata and controls

50 lines (35 loc) · 1.14 KB

Mirage

Image manipulation for Elixir.

This library provides a Rust implemented NIF which currently supports resizing images.

Installation

Because this library is partially implemented in Rust, you will need to have the Rust toolchain installed on your system.

Install Rust

curl https://sh.rustup.rs -sSf | sh

Add package to your mix.exs

If available in Hex, the package can be installed by adding mirage to your list of dependencies in mix.exs:

def deps do
  [
    {:mirage, "~> 0.1.0"}
  ]
end

Basic usage

{:ok, bytes} = File.read("/path/to/image.png")
{:ok, mirage} = Mirage.from_bytes(bytes)
{:ok, new_bytes, mirage} = Mirage.resize(mirage, 400, 300)

mirage.width #=> 400
mirage.height #=> 300

File.write!("/path/to/resized-400x300.png", new_bytes)

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/mirage.