serialimagedata

Crates.ioserialimagedata
lib.rsserialimagedata
version1.0.0
sourcesrc
created_at2023-10-03 20:37:35.400775
updated_at2023-10-03 20:37:35.400775
descriptionSerialization for the [image](https://crates.io/crates/image) crate's DynamicImage type, with additional metadata.
homepagehttps://crates.io/crates/serialimagedata
repositoryhttps://github.com/sunipkm/serialimagedata
max_upload_size
id991525
size31,979
Sunip Mukherjee (sunipkm)

documentation

README

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.

Commit count: 20

cargo fmt