Skip to main content

ExifTool

Struct ExifTool 

Source
pub struct ExifTool { /* private fields */ }

Implementations§

Source§

impl ExifTool

Source

pub fn new() -> Self

Create a new ExifTool instance with default options.

Source

pub fn with_options(options: Options) -> Self

Create a new ExifTool instance with custom options.

Source

pub fn options_mut(&mut self) -> &mut Options

Get a mutable reference to the options.

Source

pub fn options(&self) -> &Options

Get a reference to the options.

Source

pub fn set_new_value(&mut self, tag: &str, value: Option<&str>)

Queue a new tag value for writing.

Call this one or more times, then call write_info() to apply changes.

§Arguments
  • tag - Tag name, optionally prefixed with group (e.g., “Artist”, “XMP:Title”, “EXIF:Copyright”)
  • value - New value, or None to delete the tag
§Example
use exiftool_rs::ExifTool;
let mut et = ExifTool::new();
et.set_new_value("Artist", Some("John Doe"));
et.set_new_value("Copyright", Some("2024 John Doe"));
et.set_new_value("XMP:Title", Some("My Photo"));
et.write_info("photo.jpg", "photo_out.jpg").unwrap();
Source

pub fn clear_new_values(&mut self)

Clear all queued new values.

Source

pub fn set_new_values_from_file<P: AsRef<Path>>( &mut self, src_path: P, tags_to_copy: Option<&[&str]>, ) -> Result<u32>

Copy tags from a source file, queuing them as new values.

Reads all tags from src_path and queues them for writing. Optionally filter by tag names.

Source

pub fn set_file_name_from_tag<P: AsRef<Path>>( &self, path: P, tag_name: &str, template: &str, ) -> Result<String>

Set a file’s name based on a tag value.

Source

pub fn write_info<P: AsRef<Path>, Q: AsRef<Path>>( &self, src_path: P, dst_path: Q, ) -> Result<u32>

Write queued changes to a file.

If dst_path is the same as src_path, the file is modified in-place (via a temporary file).

Source

pub fn image_info<P: AsRef<Path>>(&self, path: P) -> Result<ImageInfo>

Extract metadata from a file and return a simple name→value map.

This is the high-level one-shot API, equivalent to ExifTool’s ImageInfo().

Source

pub fn extract_info<P: AsRef<Path>>(&self, path: P) -> Result<Vec<Tag>>

Extract all metadata tags from a file.

Returns the full Tag structs with groups, raw values, etc.

Source

pub fn extract_info_from_bytes( &self, data: &[u8], path: &Path, ) -> Result<Vec<Tag>>

Extract metadata from in-memory data.

Trait Implementations§

Source§

impl Default for ExifTool

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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>,

Source§

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>,

Source§

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.