exiftool_rs/lib.rs
1//! # exiftool-rs
2//!
3//! A pure Rust reimplementation of [ExifTool](https://exiftool.org/) for reading, writing,
4//! and editing metadata in image, audio, video, and document files.
5//!
6//! **194/194 test files (100%)** produce identical tag names as Perl ExifTool v13.52.
7//! Over 11,600 tags verified across 55+ file formats.
8//!
9//! ## Quick Start
10//!
11//! ```no_run
12//! use exiftool_rs::ExifTool;
13//!
14//! let et = ExifTool::new();
15//! let tags = et.extract_info("photo.jpg").unwrap();
16//! for tag in &tags {
17//! println!("{}: {}", tag.name, tag.print_value);
18//! }
19//! ```
20//!
21//! ## One-liner
22//!
23//! ```no_run
24//! let info = exiftool_rs::image_info("photo.jpg").unwrap();
25//! println!("Camera: {}", info.get("Model").unwrap_or(&String::new()));
26//! ```
27//!
28//! ## Writing Tags
29//!
30//! ```no_run
31//! use exiftool_rs::ExifTool;
32//!
33//! let mut et = ExifTool::new();
34//! et.set_new_value("Artist", Some("John Doe"));
35//! et.write_info("photo.jpg", "photo_out.jpg").unwrap();
36//! ```
37//!
38//! ## Supported Formats (55+ readers, 15 writers)
39//!
40//! **Images**: JPEG, TIFF, PNG, WebP, PSD, BMP, GIF, HEIF/AVIF, ICO, XCF, BPG, MIFF, PGF
41//!
42//! **Raw**: CR2, CR3, CRW, NEF, DNG, ARW, ORF, RAF, RW2, PEF, SR2, X3F, IIQ, 3FR, ERF, MRW
43//!
44//! **Video**: MP4/MOV, AVI, MKV, MTS, WTV, DV, FLV, SWF, MXF
45//!
46//! **Audio**: MP3, FLAC, WAV, OGG, AAC, AIFF, APE, MPC, WavPack, DSF, Audible
47//!
48//! **Documents**: PDF, RTF, HTML, PostScript, DjVu, OpenDocument, TNEF
49//!
50//! **Scientific**: DICOM, MRC, FITS, XISF
51//!
52//! **Other**: EXE/ELF/Mach-O, ZIP/RAR/GZ, ISO, LNK, Torrent, VCard, MIE, Lytro LFP, FLIR FPF, CaptureOne EIP
53//!
54//! **MakerNotes**: Canon, Nikon, Sony, Pentax, Olympus, Panasonic, Fujifilm, Samsung,
55//! Sigma, Casio, Ricoh, Minolta, Apple, Google, FLIR, GE, GoPro
56
57pub mod composite;
58pub mod config;
59pub mod error;
60
61
62pub mod geolocation;
63pub mod i18n;
64pub mod exiftool;
65pub mod file_type;
66pub mod formats;
67pub mod metadata;
68pub mod tag;
69pub mod tags;
70pub mod value;
71pub mod writer;
72pub mod md5;
73
74// Re-export main types at crate root
75pub use crate::error::{Error, Result};
76pub use crate::exiftool::{ExifTool, ImageInfo, Options};
77pub use crate::file_type::FileType;
78pub use crate::tag::{Tag, TagGroup, TagId};
79pub use crate::value::Value;
80
81/// Convenience function: extract metadata from a file in one call.
82pub fn image_info<P: AsRef<std::path::Path>>(
83 path: P,
84) -> Result<ImageInfo> {
85 ExifTool::new().image_info(path)
86}
87
88/// Detect the file type of the given file.
89pub fn get_file_type<P: AsRef<std::path::Path>>(path: P) -> Result<FileType> {
90 crate::exiftool::get_file_type(path)
91}
92
93/// Library version.
94pub const VERSION: &str = env!("CARGO_PKG_VERSION");