Function lab::rgb_bytes_to_labs[][src]

pub fn rgb_bytes_to_labs(bytes: &[u8]) -> Vec<Lab>
Expand description

RGB to Lab conversion that operates on a flat &[u8] of consecutive RGB triples.

Example

let rgbs = &[255u8, 0, 0, 255, 0, 255, 0, 255, 255];
let labs = lab::rgb_bytes_to_labs(rgbs);
assert_eq!(labs, vec![
    Lab { l: 53.238235, a: 80.09231, b: 67.202095 },
    Lab { l: 60.322693, a: 98.23698, b: -60.827957 },
    Lab { l: 91.11428, a: -48.08274, b: -14.12958 }
]);