Expand description
§img-parts
The img-parts crate provides a low level api for reading and
writing containers from various image formats.
It currently supports Jpeg,
Png and RIFF
(with some helper functions for WebP).
§Reading and writing raw ICCP and EXIF metadata
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)?;§Modifying chunks
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)?;Modules§
Structs§
- Bytes
- A cheaply cloneable and sliceable chunk of contiguous memory.
- Image
Encoder - An encoder for and image container or for an image chunk
- Image
Encoder Reader std - A reader for
ImageEncoderthat will never fail
Enums§
- DynImage
- An enum wrapping the common functions shared by the different image formats
- Error
- The Errors that may occur when processing an image.
Traits§
- ImageEXIF
- Trait to read and write the raw EXIF metadata for an image
- ImageICC
- Trait to read and write the raw ICC Profile for an image