#image #serialization #deserialize

yanked serialimagedata

Serialization for the image crate’s DynamicImage type, with additional metadata

1 stable release

1.0.0 Oct 3, 2023

#178 in #deserialization

MIT/Apache

32KB
767 lines

serialimagedata

A SerialImageData object encapsulates the generic image types defined in the image crate, along with any metadata, in order to obtain a portable, pixel format independent image that is serializable.

Usage

Add the following to your Cargo.toml:

[dependencies]
serialimageadata = "1.0.0"

and the following to your source code:

use serialimageadata::{ImageMetaData, SerialImageData, SerialImagePixel, SerialImageStorageTypes};

Then, you can create a new image metadata object:

let meta = ImageMetaData::new(...);

Then, a SerialImageData structure can be created from a vector buffer. For example, if the buffer imgdata has 8-bit RGB values and its width and height are known,

let img = SerialImageData::new(meta, imgdata, width, height, SerialImagePixel::U8(3)); // Indicate that the data storage is backed by u8 data, with 3 elements per pixel.

Traits

SerialImageData implements the TryFrom and TryInto traits for DynamicImage.

Dependencies

~6MB
~82K SLoC