MAG format is also known as MAKI02, Maki-chan Graphics.
Cargo.toml:
toml
[dependencies]
mag-image-decoder = "0.1"
main.rs: ```rust use std::fs::File; use std::io::BufReader; use magimagedecoder::Decoder;
let file = File::open("SAMPLE.MAG").expect("failed to open file"); let decoder = Decoder::new(BufReader::new(file)).expect("failed to decode header"); let header = decoder.info(); println!("{:?}", header); let img = decoder.decode().expect("failed to decode image"); img.save("SAMPLE.png").expect("failed to save image"); ```
shell
% cargo build --release
% ./target/release/magdecode --help
% ./target/release/magdecode --outdir out *.MAG
% file out/SAMPLE.png
out/SAMPLE.png: PNG image data, 640 x 480, 8-bit/color RGB, non-interlaced
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.