Lab

Lab crate Lab documentation minimum rustc 1.31 TravisCI Build Status AppVeyor Build Status

Tools for converting RGB colors to L*a*b* measurements.

RGB colors, for this crate at least, are considered to be composed of u8 values from 0 to 255, while L*a*b* colors are represented by its own struct that uses f32 values.

Usage

Converting single values

To convert a single value, use one of the functions

```rust extern crate lab; use lab::Lab;

let pinkinlab = Lab::from_rgb(&[253, 120, 138]); // Lab { l: 66.639084, a: 52.251457, b: 14.860654 } ```

Converting multiple values

To convert slices of values

```rust extern crate lab; use lab::rgbstolabs;

let rgbs = vec![ [0xFF, 0x69, 0xB6], [0xE7, 0x00, 0x00], [0xFF, 0x8C, 0x00], [0xFF, 0xEF, 0x00], [0x00, 0x81, 0x1F], [0x00, 0xC1, 0xC1], [0x00, 0x44, 0xFF], [0x76, 0x00, 0x89], ];

let labs = rgbstolabs(&rgbs); ```

```rust extern crate lab; use lab::rgbbytesto_labs;

let rgbs = vec![ 0xFF, 0x69, 0xB6, 0xE7, 0x00, 0x00, 0xFF, 0x8C, 0x00, 0xFF, 0xEF, 0x00, 0x00, 0x81, 0x1F, 0x00, 0xC1, 0xC1, 0x00, 0x44, 0xFF, 0x76, 0x00, 0x89, ];

let labs = rgbbytesto_labs(&rgbs); ```

These functions will use x86_64 AVX2 instructions if compiled to a supported target.

Minimum Rust version

Lab 0.8.0 requires Rust >= 1.36.0 for the MaybeUninit struct

Lab 0.7.0 requires Rust >= 1.31.0 for the chunks_exact slice method