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>{
use zune_core::bytestream::ZCursor;
let mut decoder = PPMDecoder::new(ZCursor::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(())
}Re-exports§
pub use zune_core;
Structs§
- PPMDecoder
- An instance of a PPM decoder
- PPMEncoder
- A PPM encoder
Enums§
- PPMDecode
Errors - Decoding errors that may occur
- PPMEncode
Errors - Errors occurring during encoding
Functions§
- max_
out_ size - Gives expected minimum size for which the encoder wil guarantee that the given raw bytes will fit