pub struct Exif { /* private fields */ }
Expand description
Represents parsed Exif information, can be converted from an ExifIter
like this: let exif: Exif = iter.into()
.
Implementations§
Source§impl Exif
impl Exif
Sourcepub fn get(&self, tag: ExifTag) -> Option<&EntryValue>
pub fn get(&self, tag: ExifTag) -> Option<&EntryValue>
Get entry value for the specified tag
in ifd0 (the main image).
Note:
-
The parsing error related to this tag won’t be reported by this method. Either this entry is not parsed successfully, or the tag does not exist in the input data, this method will return None.
-
If you want to handle parsing error, please consider to use
ExifIter
. -
If you have any custom defined tag which does not exist in
ExifTag
, you can always get the entry value by a raw tag code, see [Self::get_by_tag_code
].§Example
use nom_exif::*; fn main() -> Result<()> { let mut parser = MediaParser::new(); let ms = MediaSource::file_path("./testdata/exif.jpg")?; let iter: ExifIter = parser.parse(ms)?; let exif: Exif = iter.into(); assert_eq!(exif.get(ExifTag::Model).unwrap(), &"vivo X90 Pro+".into()); Ok(()) }
Sourcepub fn get_by_ifd_tag_code(&self, ifd: usize, tag: u16) -> Option<&EntryValue>
pub fn get_by_ifd_tag_code(&self, ifd: usize, tag: u16) -> Option<&EntryValue>
Get entry value for the specified tag
in the specified ifd
.
ifd
value range:
- 0: ifd0 (the main image)
- 1: ifd1 (thumbnail image)
Note:
-
The parsing error related to this tag won’t be reported by this method. Either this entry is not parsed successfully, or the tag does not exist in the input data, this method will return None.
-
If you want to handle parsing error, please consider to use
ExifIter
.§Example
use nom_exif::*; fn main() -> Result<()> { let mut parser = MediaParser::new(); let ms = MediaSource::file_path("./testdata/exif.jpg")?; let iter: ExifIter = parser.parse(ms)?; let exif: Exif = iter.into(); assert_eq!(exif.get_by_ifd_tag_code(0, 0x0110).unwrap(), &"vivo X90 Pro+".into()); assert_eq!(exif.get_by_ifd_tag_code(1, 0xa002).unwrap(), &240_u32.into()); Ok(()) }
Sourcepub fn get_values<'b>(
&self,
tags: &'b [ExifTag],
) -> Vec<(&'b ExifTag, EntryValue)>
👎Deprecated since 1.5.0: please use [Self::get
] or [ExifIter
] instead
pub fn get_values<'b>( &self, tags: &'b [ExifTag], ) -> Vec<(&'b ExifTag, EntryValue)>
Self::get
] or [ExifIter
] insteadGet entry values for the specified tags
in ifd0 (the main image).
Please note that this method will ignore errors encountered during the search and parsing process, such as missing tags or errors in parsing values, and handle them silently.
Sourcepub fn get_value(&self, tag: &ExifTag) -> Result<Option<EntryValue>>
👎Deprecated since 1.5.0: please use [Self::get
] instead
pub fn get_value(&self, tag: &ExifTag) -> Result<Option<EntryValue>>
Self::get
] insteadGet entry value for the specified tag
in ifd0 (the main image).
Sourcepub fn get_value_by_tag_code(&self, tag: u16) -> Result<Option<EntryValue>>
👎Deprecated since 1.5.0: please use [Self::get_by_tag_code
] instead
pub fn get_value_by_tag_code(&self, tag: u16) -> Result<Option<EntryValue>>
Self::get_by_tag_code
] insteadGet entry value for the specified tag
in ifd0 (the main image).
Sourcepub fn get_gps_info(&self) -> Result<Option<GPSInfo>>
pub fn get_gps_info(&self) -> Result<Option<GPSInfo>>
Get parsed GPS information.