Crate pnm

source ·
Expand description

crate for decoding/encoding the portable anymap format.

§a quick guide to the various functions for everyday use

  • decode(): your go-to for all PNM image decoding. If you have a specific format you need to support, use its module directly. Note that this function reads both plain and raw formats.
  • encode(): this function is a little tricky. It supports the “older” PNM formats, and, due to their age they do not support the alpha channels existence. If possible, use pam::encode instead.
  • encode_plain: The PAM format doesnt actually support read-age-by-humans, so this is still useful at times. Outputs data in decimal digits.

§functions in action

let data = include_bytes!("../tdata/fimg-rainbowR.ppm");
let out = pnm::decode(data).unwrap();

assert_eq!(pnm::encode(out), data);

Re-exports§

  • pub use pam::PAM;

Modules§

Functions§