Low level crate for reading and writing Jpeg, Png and RIFF image containers
See the codeThe img-parts crate provides a low level API for reading and
writing containers from various image formats, and a high level
API for reading and writing raw ICC profiles and EXIF metadata.
It currently supports Jpeg, Png and RIFF (with some helper
functions for WebP).
More examples can be found in the examples directory on GitHub.
use std::fs::{self, File};
use img_parts::jpeg::Jpeg;
use img_parts::{ImageEXIF, ImageICC};
let input = fs::read("img.jpg")?;
let output = File::create("out.jpg")?;
let mut jpeg = Jpeg::from_bytes(input.into())?;
let icc_profile = jpeg.icc_profile();
let exif_metadata = jpeg.exif();
jpeg.set_icc_profile(Some(another_icc_profile.into()));
jpeg.set_exif(Some(new_exif_metadata.into()));
jpeg.encoder().write_to(output)?;
use std::fs::{self, File};
use img_parts::jpeg::{markers, Jpeg, JpegSegment};
use img_parts::Bytes;
let input = fs::read("img.jpg")?;
let output = File::create("out.jpg")?;
let mut jpeg = Jpeg::from_bytes(input.into())?;
let comment = Bytes::from("Hello, I'm writing a comment!");
let comment_segment = JpegSegment::new_with_contents(markers::COM, comment);
jpeg.segments_mut().insert(1, comment_segment);
jpeg.encoder().write_to(output)?;
Licensed under either of
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.
Overall
Maintained
Code review
crates.io
Latest release
Releases this year
288 followers · starred Sep 2020
20 followers · starred Dec 2022
Low level crate for reading and writing Jpeg, Png and RIFF image containers
See the codeThe img-parts crate provides a low level API for reading and
writing containers from various image formats, and a high level
API for reading and writing raw ICC profiles and EXIF metadata.
It currently supports Jpeg, Png and RIFF (with some helper
functions for WebP).
More examples can be found in the examples directory on GitHub.
use std::fs::{self, File};
use img_parts::jpeg::Jpeg;
use img_parts::{ImageEXIF, ImageICC};
let input = fs::read("img.jpg")?;
let output = File::create("out.jpg")?;
let mut jpeg = Jpeg::from_bytes(input.into())?;
let icc_profile = jpeg.icc_profile();
let exif_metadata = jpeg.exif();
jpeg.set_icc_profile(Some(another_icc_profile.into()));
jpeg.set_exif(Some(new_exif_metadata.into()));
jpeg.encoder().write_to(output)?;
use std::fs::{self, File};
use img_parts::jpeg::{markers, Jpeg, JpegSegment};
use img_parts::Bytes;
let input = fs::read("img.jpg")?;
let output = File::create("out.jpg")?;
let mut jpeg = Jpeg::from_bytes(input.into())?;
let comment = Bytes::from("Hello, I'm writing a comment!");
let comment_segment = JpegSegment::new_with_contents(markers::COM, comment);
jpeg.segments_mut().insert(1, comment_segment);
jpeg.encoder().write_to(output)?;
Licensed under either of
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.
Overall
Maintained
Code review
crates.io
Latest release
Releases this year
288 followers · starred Sep 2020
20 followers · starred Dec 2022