#image #deserialize #png #serialization #de #save #n-darrays

bin+lib ndarray_images

(De)serialize NDarrays to/from PNG

2 unstable releases

0.1.0 Feb 7, 2025
0.0.0 Jan 12, 2025

#296 in Images

Download history 116/week @ 2025-01-08 18/week @ 2025-01-15 131/week @ 2025-02-05

154 downloads per month
Used in noisette

MIT license

11KB
209 lines

Image

(De)Serialize NDarray to/from PNG files.

Quick Start

Grayscale Images

Load

Greyscale images can be loaded into a floating point NDarray with values in the range [0, 1]:

let image: Array2<f32> = Array2::load("image.png")?;

Save

2D NDarrays can be saved as greyscale images:

image.save("image.png")?;

Colour Images

Load

Similarly, colour images can be loaded into a 3D NDarray with values in the range [0, 1]. If the image has transparency (an alpha channel) there will be 4 channels, otherwise there will be 3:

let image: Array3<f32> = Array3::load("image.png")?;

Save

Colour images can be saved in the same way:

image.save("image.png")?;

Dependencies

~3.5MB
~67K SLoC