use parallel_image::RgbaImage; #[test] fn test() { let width = 400; let height = 300; let mut image = RgbaImage::new(width, height); image.fill_pixels(|x, y| { let mut pixel = (0, 0, 0, 0); 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; pixel }); image.save_webp("test.webp").unwrap(); }