MicroPNM π¨π»
MicroPNM is a small and efficient library for parsing PNM image formats in Rust. π¦
It is designed to be minimalistic and highly optimized for resource-constrained systems, π
making it suitable for embedded contexts and WebAssembly using the include_bytes! macro. πͺ
At the moment, only reading of binary PPM (P6) is supported. π«
Usage π οΈ
Add the following to your Cargo.toml file:
[]
= "0.1.0"
In your Rust code, use it like this:
use PNMImage;
let raw_img = include_bytes!;
let ppm_img = from_parse.unwrap;
// Get the image dimensions
let width = ppm_img.width;
let height = ppm_img.height;
// Get the maximum pixel value
let max_pixel = ppm_img.maximum_pixel;
// Get the image comment
let comment = ppm_img.comment;
// Get the RGB value of a pixel
let = ppm_img.pixel_rgb.unwrap;
Minimal Allocations π§βπ»
MicroPNM is designed with minimal memory usage in mind. π This makes it suitable for use in embedded contexts or in WebAssembly modules. πΈοΈ The PNMImage type itself is simply a thin wrapper around a byte slice of raw image data. πΎ
License π
This library is licensed under the MIT license.