parallel_image 0.5.0

parallel fill pixels
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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();
}