Expand description
A Portable Pixmap and Portable FloatMap Format Decoder and Encoder
This crate supports decoding and encoding of the following ppm formats
Specification
Format | Decoder | Encoder |
---|---|---|
P1-P3 | No | No |
P5 | Yes | Yes |
P6 | Yes | Yes |
P7 | Yes | Yes |
PFM | Yes | No |
Example
- Decoding PPM
use zune_ppm::PPMDecoder;
use zune_ppm::PPMDecodeErrors;
use zune_core::result::DecodingResult;
fn main()->Result<(),PPMDecodeErrors>{
let mut decoder = PPMDecoder::new(&[]);
let pix = decoder.decode()?;
match pix {
DecodingResult::U8(_) => {
// deal with 8 bit images
}
DecodingResult::U16(_) => {
// deal with 16 bit images
}
DecodingResult::F32(_) => {
// deal with 32 bit images (PFM)
},
_=>unreachable!()};
Ok(())
}
Structs
- An instance of a PPM decoder
- A PPM encoder
Enums
- Decoding errors that may occur
- Errors occurring during encoding
Functions
- Gives expected minimum size for which the encoder wil guarrantee that the given raw bytes will fit