#jpeg #jpeg-decoder #decoder

zune-ppm

Portable Pixmap and Portable Floatmap Format Decoder and Encoder

1 unstable release

0.4.0 Nov 16, 2023

#25 in #jpeg

Download history 27/week @ 2023-11-11 18/week @ 2023-11-18 15/week @ 2023-11-25 18/week @ 2023-12-02 18/week @ 2023-12-09 10/week @ 2023-12-16 9/week @ 2023-12-23 5/week @ 2023-12-30 7/week @ 2024-01-06 22/week @ 2024-01-13 7/week @ 2024-01-20 20/week @ 2024-01-27 11/week @ 2024-02-03 18/week @ 2024-02-10

58 downloads per month
Used in zune-image

MIT OR Apache-2.0 OR Zlib

115KB
2K SLoC

zune-ppm

A Portable Pixel Format (PPM) and Portable FloatMap Format (PFM) decoder and encoder

This crate contains a decoder and encoder that understands the ppm specification and hence can parse those formats.

Format Decoder Encoder
P1-P3 No No
P5 Yes Yes
P6 Yes Yes
P7 Yes Yes
PFM Yes No

Usage

A simple decoding looks like

 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(())
 }

Note that all routes have to be handled since PPMs come in many flavours.

Speed

PPM isn't really a format where speed matters, hence benchmarks have been skipped. Nonetheless the library is still as efficient as they come

Security

The crate is continuously fuzzed in CI to ensure that untrusted input does not cause panics

The library also has #!forbid[(unsafe_code)] to help prevent any future unsafe creep.

Dependencies

~77KB