Qoix.Image (Qoix v0.1.0) View Source

A struct representing a raw image.

Link to this section Summary

Link to this section Types

Specs

colorspace() :: :srgb | :linear

Specs

format() :: :rgb | :rgba

Specs

t() :: %Qoix.Image{
  colorspace: colorspace(),
  format: format(),
  height: pos_integer(),
  pixels: binary(),
  width: pos_integer()
}

Link to this section Functions

Link to this function

from_rgb(width, height, pixels, colorspace \\ :srgb)

View Source

Specs

from_rgb(pos_integer(), pos_integer(), binary(), colorspace()) :: t()

Creates a new Qoix.Image with :rgb format.

pixels must be a binary of RGB values.

It's possible to pass an optional colorspace, which must be one of :srgb (sRGB with linear alpha) or :linear (all channels linear). If nothing is passed, the default is :srgb

Link to this function

from_rgba(width, height, pixels, colorspace \\ :srgb)

View Source

Specs

from_rgba(pos_integer(), pos_integer(), binary(), colorspace()) :: t()

Creates a new Qoix.Image with :rgba format.

pixels must be a binary of RGBA values.

It's possible to pass an optional colorspace, which must be one of :srgb (sRGB with linear alpha) or :linear (all channels linear). If nothing is passed, the default is :srgb