The img-parts
crate provides a low level api for reading and
writing containers from various image formats.
It currently supports Jpeg
and RIFF
(with some helper functions
for WebP
).
With it you can read an image, modify its sections and save it back.
use img_parts::jpeg::Jpeg;
use img_parts::{ImageEXIF, ImageICC};
let input = File::open("img.jpg")?;
let output = File::create("out.jpg")?;
let mut jpeg = Jpeg::read(&mut BufReader::new(input))?;
let icc_profile = jpeg.icc_profile();
let exif_metadata = jpeg.exif();
jpeg.set_icc_profile(Some(another_icc_profile));
jpeg.set_exif(Some(new_exif_metadata));
jpeg.write_to(&mut BufWriter::new(output))?;
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.