{"id":15032694,"url":"https://github.com/maciektalaska/tinyppm","last_synced_at":"2025-04-09T21:23:21.430Z","repository":{"id":57669895,"uuid":"189875619","full_name":"MaciekTalaska/tinyppm","owner":"MaciekTalaska","description":"tiny Rust library for loading .ppm files","archived":false,"fork":false,"pushed_at":"2020-08-29T20:23:24.000Z","size":24,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T23:16:15.694Z","etag":null,"topics":["image","library","ppm-format","ppm-image","rust","rust-lang","rust-language"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MaciekTalaska.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-02T17:28:57.000Z","updated_at":"2020-03-26T21:51:59.000Z","dependencies_parsed_at":"2022-09-26T20:40:39.689Z","dependency_job_id":null,"html_url":"https://github.com/MaciekTalaska/tinyppm","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaciekTalaska%2Ftinyppm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaciekTalaska%2Ftinyppm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaciekTalaska%2Ftinyppm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MaciekTalaska%2Ftinyppm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MaciekTalaska","download_url":"https://codeload.github.com/MaciekTalaska/tinyppm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248113103,"owners_count":21049783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image","library","ppm-format","ppm-image","rust","rust-lang","rust-language"],"created_at":"2024-09-24T20:19:09.008Z","updated_at":"2025-04-09T21:23:21.406Z","avatar_url":"https://github.com/MaciekTalaska.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"tinyppm\n=======\n\nSimple .ppm loader written in Rust.\n\nThis is more of a toy project, I have written, to be able to easy reuse it for some of my experiments with 2d graphics in Rust.\n\nUsage\n-----\n\n**v.0.20.0 Note:** This version introduces proper error handling. Earlier `tinyppm` was a bit of pain as it exited when something unexpected happened (unrecognized header, unsupported color depth, non-existing/unreadable file specified...). \n Currently `tinyppm` returns an error in case some problem occurs. It is responsibility of the consumer to decide if this is critical or not, and take appropriate action.\n \n **Note:** the above change will require some slight modification of code that relies on `tinyppm 0.1.x`.\n\n1. Add `tinyppm` to your `Cargo.toml`\n2. Call `read_image_data`:\n\n```rust\nextern crate tinyppm;\n\nfn my_function(filename: \u0026String) {\n    let ppm_image_result = tinyppm::ppm_loader::read_image_data(filename);\n    let ppm_image = match ppm_image_result {\n        Ok(image) =\u003e image,\n        _ =\u003e panic!(\"unable to read specified image file!\"),\n    };\n    // `ppm_image` is now a struct containing image with, height and pixels \n}\n\n```\n\nThe structure returned is defined as follows:\n\n```rust\npub struct PPMImage {\n    height: usize,\n    width: usize,\n    pixels: Vec\u003cu32\u003e,\n}\n```\nand  it exposes 3 public methods:\n\n```rust\n    pub fn height() -\u003e usize {\n        // returns image height\n    }\n\n    pub fn width() -\u003e usize {\n        // returns image width\n    }\n\n    pub fn pixels() -\u003e \u0026Vec\u003cu32\u003e {\n        // returns reference to buffer containing pixels\n    } \n```\n\nDetails:\n--------\n\n- only 'raw ppm' format is supported (the most popular format of ppm. More details: [ppm format specification][ppm] ).\n\n- `tinyppm` supports only True Color images (i.e. 24bits per pixel - 3 color channels \u0026 8 bits per channel). After the image is read it is converted to RGB+A format (32bpp) so that it is ready to be pushed directly to framebuffer.\n\n[ppm]: http://netpbm.sourceforge.net/doc/ppm.html\n\nAdditional examples:\n--------------------\n\nIf 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\n\nLicense\n-------\nThis code is released under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaciektalaska%2Ftinyppm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaciektalaska%2Ftinyppm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaciektalaska%2Ftinyppm/lists"}