Exiv2 is a C++ library and command line tool for managing image metadata, specifically designed to handle EXIF, IPTC, and XMP data embedded in image files. It allows developers and users to read, write, delete, and modify metadata across a wide range of image formats. This tutorial explains how to install Exiv2 on Ubuntu 24.04.
Install Exiv2
Get the latest version number of Exiv2 from the official GitHub repository:
EXIV2_VERSION=$(curl -s "https://api.github.com/repos/Exiv2/exiv2/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')
Download the latest precompiled binary archive using the version number obtained previously:
wget -qO exiv2.tar.gz https://github.com/Exiv2/exiv2/releases/latest/download/exiv2-${EXIV2_VERSION}-Linux-x86_64.tar.gz
Create a temporary directory and extract the files to it:
mkdir exiv2-temp
tar xf exiv2.tar.gz --strip-components=1 -C exiv2-temp
Move the binary, library, and header files to a dedicated directory:
sudo mkdir /opt/exiv2
sudo mv exiv2-temp/{bin,lib,include} /opt/exiv2
Create a symbolic link so the exiv2
command to make accessible system-wide:
sudo ln -s /opt/exiv2/bin/exiv2 /usr/local/bin/exiv2
Verify that Exiv2 is installed correctly by checking the installed version:
exiv2 --version
Clean up temporary files used during installation:
rm -rf exiv2.tar.gz exiv2-temp
Testing Exiv2
Download a sample image with embedded EXIF metadata for testing purposes:
wget -qO test.jpg https://raw.githubusercontent.com/ianare/exif-samples/master/jpg/exif-org/nikon-e950.jpg
Run Exiv2 on the test image to display its metadata, including camera model, date taken, and more:
exiv2 test.jpg
Output:
File name : test.jpg
File size : 164151 Bytes
MIME type : image/jpeg
Image size : 800 x 600
Thumbnail : image/jpeg, 4662 Bytes
Camera make : NIKON
Camera model : E950
Image timestamp : 2001:04:06 11:51:40
File number :
Exposure time : 1/77 s
Aperture : F5.5
Exposure bias : 0 EV
Flash : No flash
Flash bias :
Focal length : 12.8 mm
Subject distance:
ISO speed : 80
Exposure mode : Auto
Metering mode : Multi-segment
Macro mode :
Image quality : (12)
White balance : Auto
Copyright :
Exif comment :
Uninstall Exiv2
If you wish to completely remove Exiv2, delete the installation directory:
sudo rm -rf /opt/exiv2
Remove the symbolic link:
sudo rm -rf /usr/local/bin/exiv2
Leave a Comment
Cancel reply