View Source Layers (Layers v0.1.1)

Layers

This library is heavily inspired by mirage and provides a Rust NIF that wraps the image crate and currently supports overlaying images.

installation

Installation

This library requires the Rust toolchain to compile.

install-rust

Install rust

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

add-package

Add package

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

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

usage

Usage

raw_bg_image = File.read!("/path/to/bg.png")
raw_fg_image = File.read!("/path/to/fg.png")

{:ok, bg_image} = Layers.from_bytes(raw_bg_image)
{:ok, fg_image} = Layers.from_bytes(raw_fg_image)

{:ok, bytes, _image} = Layers.layer_images(bg_image.data, fg_image.data, _x = 0, _y = 0)

File.write!("output.png", bytes)

Link to this section Summary

Link to this section Functions

Link to this function

layer_images(bg_image, fg_image, x, y)

View Source