use webp_encoder::webp_encode_lossless_rgba;
#[test]
fn test() {
let width = 400;
let height = 300;
let mut data = vec![0; width * height * 4].into_boxed_slice();
data.chunks_mut(4).enumerate().for_each(|(index, pixel)| {
let x = index % width;
let y = index / width;
pixel[0] = (x as f64 / (width - 1) as f64 * 256.0) as u8;
pixel[1] = (y as f64 / (height - 1) as f64 * 256.0) as u8;
pixel[2] = 0;
pixel[3] = 127;
});
let res = webp_encode_lossless_rgba(&data, width, height).unwrap();
std::fs::write("test.webp", res.webp_file()).unwrap();
}