CvtColor

Functions for converting image color.

OS Build Status
Ubuntu 20.04 CI
macOS 11 CI

Usage

bgr565_data = CvtColor.cvt(binary_data, :bgr888, :bgr565)

Currently supported pairs:

src color dst color
:bgr888:bgr565
:bgr888:rgb565
:rgb888:bgr565
:rgb888:rgb565
:bgr888:bgr666
:bgr888:rgb666
:rgb888:bgr666
:rgb888:rgb666

Each component in bgr666 and rgb666 takes 8bit space, but only bits in MSB(7-2) are valid.

 MSB 7                                       LSB
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐
│  X  │  X  │  X  │  X  │  X  │  X  │  -  │  -  │
└─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘

X indicates valid bit. - indicates ignored bit.

Installation

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

def deps do
  [
    {:cvt_color, "~> 0.1.1"}
  ]
end

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