Struct exif::Reader

source ·
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

source

pub fn new() -> Self

Constructs a new Reader.

source

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.

source

pub fn read_from_container<R>(&self, reader: &mut R) -> Result<Exif, Error>
where R: BufRead + Seek,

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.