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//! **195/195 test files (100%)** produce identical tag names *and values* as Perl
7//! ExifTool 13.59 — over 10,000 tags across the corpus. The comparison runs live in
8//! CI and is published as a tag-by-tag
9//! [parity report](https://le-syl21.github.io/exiftool-rs/).
10//!
11//! ## Quick Start
12//!
13//! ```no_run
14//! use exiftool_rs::ExifTool;
15//!
16//! let et = ExifTool::new();
17//! let tags = et.extract_info("photo.jpg").unwrap();
18//! for tag in &tags {
19//! println!("{}: {}", tag.name, tag.print_value);
20//! }
21//! ```
22//!
23//! ## One-liner
24//!
25//! ```no_run
26//! let info = exiftool_rs::image_info("photo.jpg").unwrap();
27//! println!("Camera: {}", info.get("Model").unwrap_or(&String::new()));
28//! ```
29//!
30//! ## Writing Tags
31//!
32//! ```no_run
33//! use exiftool_rs::ExifTool;
34//!
35//! let mut et = ExifTool::new();
36//! et.set_new_value("Artist", Some("John Doe"));
37//! et.write_info("photo.jpg", "photo_out.jpg").unwrap();
38//! ```
39//!
40//! ## Supported Formats (93 readers, 15 writers)
41//!
42//! **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
43//!
44//! **Raw**: CR2, CR3, CRW, CRM, NEF, DNG, ARW, ORF, RAF, RW2, PEF, SR2, X3F, IIQ, 3FR, ERF, MRW, SRW, Rawzor, KyoceraRaw
45//!
46//! **Video**: MP4/MOV, AVI, MKV, MTS, MPEG, WTV, DV, FLV, SWF, MXF, ASF/WMV, Real
47//!
48//! **Audio**: MP3, FLAC, WAV, OGG, AAC, AIFF, APE, MPC, WavPack, DSF, Audible, Opus
49//!
50//! **Documents**: PDF, RTF, HTML, PostScript, DjVu, OpenDocument, TNEF, Font (TTF/OTF/WOFF)
51//!
52//! **Scientific**: DICOM, MRC, FITS, XISF, DPX, LIF (Leica)
53//!
54//! **Archives**: ZIP, 7Z, RAR, GZIP, ISO, Torrent
55//!
56//! **Other**: EXE/ELF/Mach-O, LNK, VCard, ICS, JSON, PLIST, MIE, Lytro LFP, FLIR FPF, CaptureOne EIP, Palm PDB, PCAP
57//!
58//! **Timed metadata** (`-ee`): freeGPS (dashcams), GoPro GPMF, Google CAMM, NMEA, Kenwood, DJI, Insta360
59//!
60//! **MakerNotes**: Canon, Nikon, Sony, Pentax, Olympus, Panasonic, Fujifilm, Samsung,
61//! Sigma, Casio, Ricoh, Minolta, Apple, Google, FLIR, GE, GoPro
62//!
63//! # Community & support
64//!
65//! Questions, bugs, beta testing — join the Discord: <https://discord.gg/T37DYHmt2j>
66
67pub mod composite;
68pub mod config;
69pub mod encoding;
70pub mod error;
71
72pub mod exiftool;
73pub mod file_type;
74pub mod formats;
75pub mod geolocation;
76pub mod geotag;
77pub mod i18n;
78pub mod md5;
79pub mod metadata;
80pub mod tag;
81pub mod tags;
82pub mod value;
83pub mod writer;
84
85// Re-export main types at crate root
86pub use crate::error::{Error, Result};
87pub use crate::exiftool::{ExifTool, ImageInfo, Options};
88pub use crate::file_type::FileType;
89pub use crate::tag::{Tag, TagGroup, TagId};
90pub use crate::value::Value;
91
92/// Convenience function: extract metadata from a file in one call.
93pub fn image_info<P: AsRef<std::path::Path>>(path: P) -> Result<ImageInfo> {
94 ExifTool::new().image_info(path)
95}
96
97/// Detect the file type of the given file.
98pub fn get_file_type<P: AsRef<std::path::Path>>(path: P) -> Result<FileType> {
99 crate::exiftool::get_file_type(path)
100}
101
102/// Library version.
103pub const VERSION: &str = env!("CARGO_PKG_VERSION");
104
105/// The Perl ExifTool release this crate mirrors — the single source of truth
106/// for "which ExifTool are we iso with". Bump it when the ported tables /
107/// print conversions are regenerated against a newer ExifTool. The `parity`
108/// binary pins this version by default when diffing live against Perl.
109pub const EXIFTOOL_VERSION: &str = "13.59";