Skip to main content

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//!
61//! # Community & support
62//!
63//! Questions, bugs, beta testing — join the Discord: <https://discord.gg/T37DYHmt2j>
64
65pub mod composite;
66pub mod config;
67pub mod encoding;
68pub mod error;
69
70pub mod exiftool;
71pub mod file_type;
72pub mod formats;
73pub mod geolocation;
74pub mod geotag;
75pub mod i18n;
76pub mod md5;
77pub mod metadata;
78pub mod tag;
79pub mod tags;
80pub mod value;
81pub mod writer;
82
83// Re-export main types at crate root
84pub use crate::error::{Error, Result};
85pub use crate::exiftool::{ExifTool, ImageInfo, Options};
86pub use crate::file_type::FileType;
87pub use crate::tag::{Tag, TagGroup, TagId};
88pub use crate::value::Value;
89
90/// Convenience function: extract metadata from a file in one call.
91pub fn image_info<P: AsRef<std::path::Path>>(path: P) -> Result<ImageInfo> {
92    ExifTool::new().image_info(path)
93}
94
95/// Detect the file type of the given file.
96pub fn get_file_type<P: AsRef<std::path::Path>>(path: P) -> Result<FileType> {
97    crate::exiftool::get_file_type(path)
98}
99
100/// Library version.
101pub const VERSION: &str = env!("CARGO_PKG_VERSION");