ndarray_images 0.1.0

(De)serialize NDarrays to/from PNG
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use ndarray::Array3;
use ndarray_images::Image;

const INPUT_DIR: &str = "input";
const OUTPUT_DIR: &str = "output";
const IMAGE_NAME: &str = "colour_alpha.png";

fn main() {
    let image_path = &format!("{}/{}", INPUT_DIR, IMAGE_NAME);
    let image: Array3<f32> = Array3::load(image_path).expect("Failed to load image");

    println!("{:?}", image);

    let output_path = &format!("{}/{}", OUTPUT_DIR, IMAGE_NAME);
    image.save(output_path).expect("Failed to save image");
}