exiftool_rs/lib.rs
1//! # exiftool
2//!
3//! A Rust reimplementation of [ExifTool](https://exiftool.org/) for reading, writing,
4//! and editing metadata in image, audio, video, and document files.
5//!
6//! ## Quick Start
7//!
8//! ```no_run
9//! use exiftool_rs::ExifTool;
10//!
11//! let et = ExifTool::new();
12//! let tags = et.extract_info("photo.jpg").unwrap();
13//! for tag in &tags {
14//! println!("{}: {}", tag.name, tag.print_value);
15//! }
16//! ```
17//!
18//! ## One-liner
19//!
20//! ```no_run
21//! let info = exiftool_rs::image_info("photo.jpg").unwrap();
22//! println!("Camera: {}", info.get("Model").unwrap_or(&String::new()));
23//! ```
24//!
25//! ## Writing Tags
26//!
27//! ```no_run
28//! use exiftool_rs::ExifTool;
29//!
30//! let mut et = ExifTool::new();
31//! et.set_new_value("Artist", Some("John Doe"));
32//! et.write_info("photo.jpg", "photo_out.jpg").unwrap();
33//! ```
34//!
35//! ## Supported Formats (30+ readers, 15 writers)
36//!
37//! **Images**: JPEG, TIFF, PNG, WebP, PSD, BMP, GIF, HEIF/AVIF, ICO
38//! **Raw**: CR2, NEF, DNG, ARW, ORF, RAF, RW2, PEF, SR2, X3F, 3FR, ERF
39//! **Video**: MP4/MOV, AVI, MKV
40//! **Audio**: MP3, FLAC, WAV, OGG
41//! **Documents**: PDF
42
43pub mod composite;
44pub mod config;
45pub mod error;
46
47
48pub mod geolocation;
49pub mod exiftool;
50pub mod file_type;
51pub mod formats;
52pub mod metadata;
53pub mod tag;
54pub mod tags;
55pub mod value;
56pub mod writer;
57pub mod md5;
58
59// Re-export main types at crate root
60pub use crate::error::{Error, Result};
61pub use crate::exiftool::{ExifTool, ImageInfo, Options};
62pub use crate::file_type::FileType;
63pub use crate::tag::{Tag, TagGroup, TagId};
64pub use crate::value::Value;
65
66/// Convenience function: extract metadata from a file in one call.
67pub fn image_info<P: AsRef<std::path::Path>>(
68 path: P,
69) -> Result<ImageInfo> {
70 ExifTool::new().image_info(path)
71}
72
73/// Detect the file type of the given file.
74pub fn get_file_type<P: AsRef<std::path::Path>>(path: P) -> Result<FileType> {
75 crate::exiftool::get_file_type(path)
76}
77
78/// Library version.
79pub const VERSION: &str = env!("CARGO_PKG_VERSION");