pub struct Reader {}
Expand description
A struct to parse the Exif attributes and
create an Exif
instance that holds the results.
§Examples
use exif::{In, Reader, Tag};
let file = std::fs::File::open("tests/exif.jpg")?;
let exif = Reader::new()
.read_from_container(&mut std::io::BufReader::new(&file))?;
let xres = exif.get_field(Tag::XResolution, In::PRIMARY)
.ok_or(Error("tests/exif.jpg must have XResolution"))?;
assert_eq!(xres.display_value().with_unit(&exif).to_string(),
"72 pixels per inch");
Implementations§
source§impl Reader
impl Reader
sourcepub fn read_raw(&self, data: Vec<u8>) -> Result<Exif, Error>
pub fn read_raw(&self, data: Vec<u8>) -> Result<Exif, Error>
Parses the Exif attributes from raw Exif data.
If an error occurred, exif::Error
is returned.
sourcepub fn read_from_container<R>(&self, reader: &mut R) -> Result<Exif, Error>
pub fn read_from_container<R>(&self, reader: &mut R) -> Result<Exif, Error>
Reads an image file and parses the Exif attributes in it.
If an error occurred, exif::Error
is returned.
Supported formats are:
- TIFF and some RAW image formats based on it
- JPEG
- HEIF and coding-specific variations including HEIC and AVIF
- PNG
- WebP
This method is provided for the convenience even though parsing containers is basically out of the scope of this library.
Auto Trait Implementations§
impl Freeze for Reader
impl RefUnwindSafe for Reader
impl Send for Reader
impl Sync for Reader
impl Unpin for Reader
impl UnwindSafe for Reader
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more