pix
Library for image conversion and compositing.
A raster image can be cheaply converted to and from raw byte buffers, enabling interoperability with other crates.
Many image formats are supported:
- Bit depth: 8- or 16-bit integer and 32-bit float
- Alpha: premultiplied or straight
- Gamma: linear or sRGB
- Color models:
RGB
/BGR
(red, green, blue)CMY
(cyan, magenta, yellow)Gray
(luma / relative luminance)HSV
(hue, saturation, value)HSL
(hue, saturation, lightness)HWB
(hue, whiteness, blackness)YCbCr
(used by JPEG)Matte
(alpha only)OkLab
(lightness, green/red, blue/yellow)XYZ
(CIE 1931 XYZ)
HWB Color Example
use ;
let mut r = with_clear;
for in r.rows_mut.enumerate
// Convert to SRgb8 color model
let raster = with_raster;
Compositing Example
Compositing is supported for premultiplied images with linear gamma.
use ;
let mut r0 = with_clear;
let r1 = with_color;
r0.composite_raster;