Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scrogson/mirage
Image manipulation package for Elixir
https://github.com/scrogson/mirage
elixir image-manipulation rust
Last synced: 2 months ago
JSON representation
Image manipulation package for Elixir
- Host: GitHub
- URL: https://github.com/scrogson/mirage
- Owner: scrogson
- License: apache-2.0
- Created: 2019-03-06T04:36:33.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-12-26T22:41:50.000Z (almost 4 years ago)
- Last Synced: 2024-10-03T12:38:16.002Z (3 months ago)
- Topics: elixir, image-manipulation, rust
- Language: Rust
- Homepage:
- Size: 47.9 KB
- Stars: 36
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://hex.pm/docs/publish), the package can be installed
by adding `mirage` to your list of dependencies in `mix.exs`:```elixir
def deps do
[
{:mirage, "~> 0.1.0"}
]
end
```## Basic usage
```ex
{: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 #=> 300File.write!("/path/to/resized-400x300.png", new_bytes)
```Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/mirage](https://hexdocs.pm/mirage).[Rust]: https://www.rust-lang.org/
[NIF]: http://erlang.org/doc/man/erl_nif.html