Function lodepng::decode_file
[−]
[src]
pub fn decode_file<P: AsRef<Path>>(filepath: P, colortype: ColorType, bitdepth: c_uint) -> Result<Image, Error>
Load PNG from disk, from file with given name. Same as the other decode functions, but instead takes a file path as input.
decode32_file
and decode24_file
are more convenient if you want specific image format.
There's also ffi::State::decode()
if you'd like to set more settings.
match decode_file(filepath, LCT_RGBA, 8) { Ok(Image::RGBA(with_alpha)) => do_stuff(with_alpha), Ok(Image::RGB(without_alpha)) => do_stuff(without_alpha), _ => panic!("¯\\_(ツ)_/¯") }