7 releases

✓ Uses Rust 2018 edition

0.1.6 Jun 12, 2019
0.1.5 Jun 6, 2019

#73 in Images

25 downloads per month

MIT license

66 lines


Simple .ppm loader written in Rust.

This is more of a toy project, I have written, to be able to easy reuse it for some of my experiments with 2d graphhics in Rust.


  1. Add tinyppm to your Cargo.toml
  2. Call read_image_data:
extern crate tinyppm;

fn my_function(filename: &String) {
    let (width, height, image) = tinyppm:ppm_loader::read_image_data(filename);
    // `image` contains 32bit image data


tinyppm supports only 'raw ppm' format (the most popular format of ppm. More details: ppm format specification ).

Another restriction that is important is that at them moment tinyppm supports reading only truecolor (24bpp - 3 color channels, 8b per channel) images. After the image is read it is converted to RGB+A format (32bpp) so that it is ready to be pushed directly to framebuffer.

Additional examples:

If you want to check how it works, please have a look at ppm_viewer which is simple image viewer written in Rust: https://github.com/MaciekTalaska/2d_effects/tree/master/ppm_viewer


This code is released under the MIT license.

No runtime deps