Rust library for converting RGB colors to the CIE-L*a*b* color space
extern crate lab;
use Lab;
let pink_in_lab = from_rgb;
// Lab { l: 66.639084, a: 52.251457, b: 14.860654 }
extern crate lab;
extern crate image;
use Lab;
use Rgba;
let pixel: = Rgba ;
let lab = from_rgba;
// Lab { l: 66.639084, a: 52.251457, b: 14.860654 }
Experimental SIMD functions
The lab::simd
module is compiled for the x86_64
cpu architecture. If the
current cpu can run AVX and SSE 4.1 operations, it can make use of the exported
functions.
extern crate lab;
use Lab;
use simd;
Performance increase over a serial map is wildly variable across CPUs, suggesting that there are still some optimizations to perform. A 2013 Macbook Air sees a ~25% decrease in benchmark times converting Labs to RGBs, and a ~40% decrease converting RGBs to Labs. Meanwhile a 6-core desktop computer sees near perfect 8x speedup converting Labs to RGBs, but a <10% improvement converting RGBs to Labs. Clearly it is a work in progress.
Minimum Rust version
Lab 0.7.0 requires Rust >= 1.31.0 for the chunks_exact slice method
Lab 0.6.0 can build as far back as Rust 1.13.0. Testing releases gets pretty tedious earlier than that.