LodePNG is a stand-alone PNG image decoder and encoder (does not require zlib nor 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
:
[]
= "0.11"
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:
decode32_file
returns lodepng::Bitmap<lodepng::RGBA<u8>>
with .width
, .height
, and .buffer
.
The RGB/RGBA pixel types are from the RGB create, which you can import separately to use the same pixel struct throughout the program, without casting.
To save an RGBA PNG file:
encode32_file
Advanced
let mut state = new;
state.remember_unknown_chunks;
match state.decode
for chunk in state.info_png.unknown_chunks
// Color profile
let icc_data = state.info_png.get_icc;