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.53.
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 (93 readers, 15 writers)
39//!
40//! **Images**: JPEG, TIFF, PNG, WebP, PSD, BMP, GIF, HEIF/AVIF, ICO, XCF, BPG, MIFF, PGF, PPM, PCX, PICT, JXR, FLIF, MNG, Radiance HDR, OpenEXR, PSP, InDesign
41//!
42//! **Raw**: CR2, CR3, CRW, CRM, NEF, DNG, ARW, ORF, RAF, RW2, PEF, SR2, X3F, IIQ, 3FR, ERF, MRW, SRW, Rawzor, KyoceraRaw
43//!
44//! **Video**: MP4/MOV, AVI, MKV, MTS, MPEG, WTV, DV, FLV, SWF, MXF, ASF/WMV, Real
45//!
46//! **Audio**: MP3, FLAC, WAV, OGG, AAC, AIFF, APE, MPC, WavPack, DSF, Audible, Opus
47//!
48//! **Documents**: PDF, RTF, HTML, PostScript, DjVu, OpenDocument, TNEF, Font (TTF/OTF/WOFF)
49//!
50//! **Scientific**: DICOM, MRC, FITS, XISF, DPX, LIF (Leica)
51//!
52//! **Archives**: ZIP, 7Z, RAR, GZIP, ISO, Torrent
53//!
54//! **Other**: EXE/ELF/Mach-O, LNK, VCard, ICS, JSON, PLIST, MIE, Lytro LFP, FLIR FPF, CaptureOne EIP, Palm PDB, PCAP
55//!
56//! **Timed metadata** (`-ee`): freeGPS (dashcams), GoPro GPMF, Google CAMM, NMEA, Kenwood, DJI, Insta360
57//!
58//! **MakerNotes**: Canon, Nikon, Sony, Pentax, Olympus, Panasonic, Fujifilm, Samsung,
59//! Sigma, Casio, Ricoh, Minolta, Apple, Google, FLIR, GE, GoPro
60
61pub mod composite;
62pub mod config;
63pub mod error;
64
65
66pub mod geolocation;
67pub mod i18n;
68pub mod exiftool;
69pub mod file_type;
70pub mod formats;
71pub mod metadata;
72pub mod tag;
73pub mod tags;
74pub mod value;
75pub mod writer;
76pub mod md5;
77
78// Re-export main types at crate root
79pub use crate::error::{Error, Result};
80pub use crate::exiftool::{ExifTool, ImageInfo, Options};
81pub use crate::file_type::FileType;
82pub use crate::tag::{Tag, TagGroup, TagId};
83pub use crate::value::Value;
84
85/// Convenience function: extract metadata from a file in one call.
86pub fn image_info<P: AsRef<std::path::Path>>(
87 path: P,
88) -> Result<ImageInfo> {
89 ExifTool::new().image_info(path)
90}
91
92/// Detect the file type of the given file.
93pub fn get_file_type<P: AsRef<std::path::Path>>(path: P) -> Result<FileType> {
94 crate::exiftool::get_file_type(path)
95}
96
97/// Library version.
98pub const VERSION: &str = env!("CARGO_PKG_VERSION");