Skip to content

haptics-nri/lodepng-rust

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#LodePNG bindings for Rust

LodePNG is a stand-alone PNG image decoder and encoder (does not require zlib or libpng).

This package allows easy reading and writing of PNG files without any system dependencies.

The easiest way to use LodePNG is to simply include the lodepng crate. To do so, add this to your Cargo.toml:

[dependencies.lodepng]
git = "https://github.com/pornel/lodepng-rust.git"

To build the lodepng crate:

cargo build

It will produce liblodepng-….rlib that you can import with extern crate lodepng.

API

See API documentation for details. The API mimics lodepng, so if something is unclear, see the original lodepng.h.

To load RGBA PNG file:

lodepng::decode32_file("in.png")

returns lodepng::Bitmap<lodepng::RGBA<u8>> with .width, .height, and .buffer.

To save RGBA PNG file:

lodepng::encode32_file("out.png", buffer.as_slice(), width, height)

Releases

No releases published

Packages

No packages published

Languages

  • Rust 98.9%
  • Makefile 1.1%