Image loading and saving
- Returned data is always 8-bit (Y/YA/RGB/RGBA/BGR/BGRA)
Format |
Decoder |
Encoder |
png |
8-bit |
8-bit non-paletted non-interlaced |
tga |
8-bit non-paletted |
8-bit non-paletted |
bmp |
8-bit |
nope |
jpeg |
baseline |
nope |
extern crate imagefmt;
use imagefmt::{ColFmt, ColType};
fn main() {
let _pic = imagefmt::read("stars.jpg", ColFmt::BGRA).unwrap();
let pic = imagefmt::read("marbles.tga", ColFmt::Auto).unwrap();
pic.write("out.png", ColType::Gray).unwrap();
imagefmt::write("out.tga", pic.w, pic.h, pic.fmt, &pic.pixels,
ColType::Gray)
.unwrap();
let _info = imagefmt::read_info("hiisi.png").unwrap();
}