search
HomeSystem TutorialLINUXHow To Manage Image Metadata Using ExifTool In Linux

This detailed guide explains what ExifTool is, how to install ExifTool on Linux, and how to use it to manage image metadata information with practical examples.

At the end, we will briefly learn the difference between two types of metadata standards, Exif and XMP. There's even a ExifTool cheat sheet included to help you remember the commands!

Table of Contents

What is ExifTool?

ExifTool, developed by Phil Harvey, is a robust command-line application and Perl library designed for managing metadata in a variety of file formats.

Using ExifTool, we can manage the hidden details (i.e. metadata) embedded within various digital files. These details can include things like:

  • Date and time a photo was taken,
  • Camera settings used,
  • Location information (GPS coordinates),
  • Author information,
  • Edits made to the file,
  • And many.

ExifTool works across different platforms (Linux, macOS, and Windows and comes in two flavors:

  • Perl library: This allows programmers to integrate ExifTool functionalities within their applications.
  • Command-line application: This is a text-based tool for users to directly interact with ExifTool.

If you're dealing with images, videos, audio files, or PDFs everyday, I can assure that ExifTool could be a best companion for you!

NOTE: EXIF stands for Exchangeable Image File Format.

Key Features of ExifTool

ExifTool is renowned for its extensive range of features that cater to diverse metadata management needs:

  • Supports Multiple Metadata Formats: ExifTool can handle numerous metadata formats such as EXIF, GPS, IPTC, XMP, JFIF, GeoTIFF, ICC Profile, Photoshop IRB, FlashPix, AFCP, ID3, and more.
  • Wide File Format Compatibility: It works with many file types, including JPEG, PNG, TIFF, RAW, MP4, MOV, and AVI.
  • Platform-Independent: ExifTool is available for Windows, macOS, and Unix-based systems.
  • Customizable Output: It offers multiple output formatting options, including tab-delimited, HTML, XML, and JSON.
  • Multi-Lingual Support: ExifTool provides output in various languages, including English, French, German, Japanese, and more.

Install ExifTool in Linux

ExifTool can be installed on Linux in a few ways.

Install ExifTool in Debian/Ubuntu

ExifTool is available in the default repositories of popular Linux operating systems.

For Debian, Ubuntu, and other Debian-based distributions, you can install ExifTool using the apt package manager:

sudo apt update
sudo apt install exiftool

This will install ExifTool and its dependencies.

Install ExifTool in in Fedora

For Fedora, you can use the dnf package manager:

sudo dnf install perl-Image-ExifTool

Install ExifTool from Source

If you prefer to install ExifTool from the source, follow these steps:

1. Download the latest version:

As of writing this guide, the latest version of ExifTool was 12.89. Let us download it using command:

wget https://exiftool.org/Image-ExifTool-12.89.tar.gz

2. Extract the downloaded file:

tar xvf Image-ExifTool-12.89.tar.gz

3. Navigate to the extracted directory:

cd Image-ExifTool-12.89

4. Install ExifTool:

Make sure you've installed the Development tools. And then run the following commands one by one:

perl Makefile.PL
make
make test
sudo make install

Install ExifTool using Git

You can also clone the ExifTool repository and install it:

1. Clone the repository:

git clone https://github.com/exiftool/exiftool.git

2. Navigate to the cloned directory:

cd exiftool

3. Run ExifTool:

./exiftool /path/to/image

These methods should help you get ExifTool up and running on your Linux system.

How to Use ExifTool to Manage Image Metadata in Linux

Here are a few basic commands to demonstrate how ExifTool can be used:

Reading Metadata

To read metadata from an image file:

exiftool image.jpg

This command displays all metadata associated with image.jpg.

Example:

I am going to display the metadata of an image file named Ostechnix.png.

exiftool Ostechnix.png

Sample Output:

ExifTool Version Number         : 12.16
File Name                       : Ostechnix.png
Directory                       : .
File Size                       : 6.4 KiB
File Modification Date/Time     : 2020:08:22 15:21:00 05:30
File Access Date/Time           : 2024:07:22 17:52:28 05:30
File Inode Change Date/Time     : 2024:07:11 13:44:03 05:30
File Permissions                : rwxrwxrwx
File Type                       : PNG
File Type Extension             : png
MIME Type                       : image/png
Image Width                     : 267
Image Height                    : 267
Bit Depth                       : 8
Color Type                      : RGB with Alpha
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
Pixels Per Unit X               : 11811
Pixels Per Unit Y               : 11811
Pixel Units                     : meters
Image Size                      : 267x267
Megapixels                      : 0.071

How To Manage Image Metadata Using ExifTool In Linux

Writing Metadata

To add or modify metadata in an image file:

exiftool -Artist="Your Name" image.jpg

This command sets the Artist tag to "Your Name" in image.jpg.

Example:

To set/change the Artist tag to "Senthil Kumar" in Ostechnix.png:

How To Manage Image Metadata Using ExifTool In Linux

Let us verify if the author's name has been really updated by reading the metadata of the file:

How To Manage Image Metadata Using ExifTool In Linux

As you can see in the output above, the artist name is added.

NOTE:When writing information, ExifTool preserves the original file by adding "_original" to the file name. You must keep a copy of the original, or thoroughly validate the new file before erasing the original.

Copying Metadata

To copy metadata from one file to another:

exiftool -TagsFromFile source.jpg target.jpg

This command copies all metadata tags from source.jpg to target.jpg.

Remove a Specific Metadata Tag

To delete a specific tag:

exiftool -TagName= filename

For example, to remove the Artist tag from image.jpg:

exiftool -Artist= image.jpg

Removing All Metadata

To remove all metadata from a file:

exiftool -all= image.jpg

This command deletes all metadata from image.jpg.

Batch Processing

Batch processing allows you to apply metadata changes to multiple files simultaneously.

To edit metadata for multiple files at once:

exiftool -Artist="John Doe" *.jpg

This command sets the Artist tag for all JPEG files in a directory.

Recursive Batch Processing

To process files in subdirectories as well, use the -r option:

exiftool -r -Artist="John Doe" /path/to/directory

This command sets the Artist tag for all JPEG files in /path/to/directory and its subdirectories.

View Available Tags

To see a list of all tags that can be edited:

exiftool -list

This command lists all the tags that ExifTool can read and write.

Extract Specific Metadata Tags

exiftool -T -createdate -aperture -shutterspeed -iso image.jpg

This command extracts the CreateDate, Aperture, ShutterSpeed, and ISO tags from image.jpg.

Example:

How To Manage Image Metadata Using ExifTool In Linux

Rename Files Based on Metadata

You can use ExifTool to rename files based on their "Date Taken" metadata with a simple command:

exiftool -d "%Y-%m-%d_%H-%M-%S%%-c.%%e" "-filename<datetimeoriginal image.jpg><p>This command renames image.jpg based on its DateTimeOriginal metadata, using the format YYYY-MM-DD_HH-MM-SS.</p>
<h3 id="Recursive-Renaming">Recursive Renaming</h3>
<p>If you want to recursively rename all files in a specific directory based on a metadata, you can use -r flag like below:</p>
<pre class="brush:php;toolbar:false">exiftool -r -d "%Y-%m-%d_%H-%M-%S%%-c.%%e" "-filename<datetimeoriginal><p>This command will recursively rename all files in the specified directory and its subdirectories.</p>
<h3 id="Handling-Duplicate-Filenames">Handling Duplicate Filenames</h3>
<p>The %%-c part of the format ensures that if there are duplicate filenames, a copy number is appended to avoid overwriting files. For example, if two files have the same date and time, they will be named 2024-07-13_12-23-21-1.jpg and 2024-07-13_12-23-21-2.jpg.</p>
<h3 id="Renaming-Specific-File-Types">Renaming Specific File Types</h3>
<p>To rename only specific file types, such as JPEG files, you can use the -ext option:</p>
<pre class="brush:php;toolbar:false">exiftool -r -ext jpg -d "%Y-%m-%d_%H-%M-%S%%-c.%%e" "-filename<datetimeoriginal><p>This command will rename only JPEG files in the specified directory and its sub-directories.</p>
<h3 id="Extract-Thumbnail-Image">Extract Thumbnail Image</h3>
<pre class="brush:php;toolbar:false">exiftool -b -ThumbnailImage image.jpg > thumbnail.jpg

This command extracts the thumbnail image from image.jpg and saves it as thumbnail.jpg.

Geotagging Images

exiftool -geotag track.log image.jpg

This command geotags image.jpg using GPS data from track.log.

Batch Geotagging

If you have a CSV file with GPS data, you can batch geotag images:

exiftool -geotag gps_data.csv /path/to/images

This command geotags all images in /path/to/images using the GPS data from gps_data.csv.

Validate Metadata

exiftool -validate -warning -error image.jpg

This command validates the metadata of image.jpg and shows any warnings or errors.

How To Manage Image Metadata Using ExifTool In Linux

Extract All Metadata to a Text File

exiftool -a -G1 -s image.jpg > metadata.txt

This command extracts all metadata from image.jpg and saves it to metadata.txt.

Extract Metadata from All Files in a Directory

exiftool -r -w .txt -common pictures

This command recursively extracts common metadata from all files in the pictures directory and writes the output to text files with the same names but with a .txt extension.

Extracting GPS Coordinates Using ExifTool

Here’s how you can extract GPS coordinates from an image using ExifTool.

Basic Extraction

exiftool -gpslatitude -gpslongitude image.jpg

This command will display the GPS latitude and longitude of image.jpg.

How To Manage Image Metadata Using ExifTool In Linux

Extracting All GPS Data

exiftool -gps* image.jpg

This command extracts all GPS-related metadata from image.jpg.

Sample Output:

GPS Latitude Ref                : NorthGPS Longitude Ref               : EastGPS Altitude Ref                : Above Sea LevelGPS Time Stamp                  : 13:37:16GPS Date Stamp                  : 2023:05:18GPS Altitude                    : 93.9 m Above Sea LevelGPS Date/Time                   : 2023:05:18 13:37:16ZGPS Latitude                    : 52 deg 40' 11.85" NGPS Longitude                   : 13 deg 16' 51.10" EGPS Position                    : 52 deg 40' 11.85" N, 13 deg 16' 51.10" E

Output to a Text File

To save the GPS coordinates to a text file:

exiftool -gpslatitude -gpslongitude -T image.jpg > gps_coordinates.txt

This command writes the GPS latitude and longitude of image.jpg to gps_coordinates.txt.

Batch Extraction

To extract GPS coordinates from all images in a directory and save them to a text file:

exiftool -filename -gpslatitude -gpslongitude -T /path/to/directory > gps_coordinates.txt

This command creates a tab-delimited file gps_coordinates.txt with the filenames and GPS coordinates of all images in the specified directory.

Output in Decimal Degrees

If you prefer the coordinates in decimal degrees, add the -n option:

exiftool -gpslatitude -gpslongitude -n image.jpg

Sample Output:

GPS Latitude                    : 52.6699589722222GPS Longitude                   : 13.280862

This command outputs the GPS coordinates in decimal degrees.

ExifTool Command Cheatsheet

1. Reading Metadata

Basic Reading:

exiftool image.jpg

Extract Specific Metadata Tags:

exiftool -T -createdate -aperture -shutterspeed -iso image.jpg

Extract All Metadata to a Text File:

exiftool -a -G1 -s image.jpg > metadata.txt

Extract Metadata from All Files in a Directory:

exiftool -r -w .txt -common pictures

2. Writing Metadata

Add or Modify a Metadata Tag:

exiftool -TagName="New Value" filename

Batch Processing (Modify Metadata for All Files in a Directory):

exiftool -Artist="John Doe" *.jpg

Recursive Batch Processing:

exiftool -r -Artist="John Doe" /path/to/directory

3. Copying Metadata

Copy Metadata from One File to Another:

exiftool -TagsFromFile source.jpg target.jpg

Copy Metadata from One File to Multiple Files:

exiftool -TagsFromFile source.jpg -ext jpg /path/to/directory

4. Removing Metadata

Remove All Metadata:

exiftool -all= image.jpg

Remove a Specific Metadata Tag:

exiftool -TagName= filename

5. Renaming Files

Rename Files Based on Date Taken:

exiftool -d "%Y-%m-%d_%H-%M-%S%%-c.%%e" "-filename<datetimeoriginal><p><strong>Recursive Renaming:</strong></p>
<pre class="brush:php;toolbar:false">exiftool -r -d "%Y-%m-%d_%H-%M-%S%%-c.%%e" "-filename<datetimeoriginal><p><strong>Renaming Specific File Types:</strong></p>
<pre class="brush:php;toolbar:false">exiftool -r -ext jpg -d "%Y-%m-%d_%H-%M-%S%%-c.%%e" "-filename<datetimeoriginal><h3 id="Geotagging-Images">6. Geotagging Images</h3>
<p><strong>Basic Geotagging:</strong></p>
<pre class="brush:php;toolbar:false">exiftool -geotag track.log image.jpg

Batch Geotagging:

exiftool -geotag gps_data.csv /path/to/images

7. Extracting GPS Coordinates

Basic Extraction:

exiftool -gpslatitude -gpslongitude image.jpg

Extracting All GPS Data:

exiftool -gps* image.jpg

Output to a Text File:

exiftool -gpslatitude -gpslongitude -T image.jpg > gps_coordinates.txt

Batch Extraction:

exiftool -filename -gpslatitude -gpslongitude -T /path/to/directory > gps_coordinates.txt

Output in Decimal Degrees:

exiftool -gpslatitude -gpslongitude -n image.jpg

8. Listing Available Tags

View Available Tags:

exiftool -list

9. Validating Metadata

Validate Metadata:

exiftool -validate -warning -error image.jpg

10. Extract Thumbnail Image

Extract Thumbnail:

exiftool -b -ThumbnailImage image.jpg > thumbnail.jpg

Difference Between Exif and XMP Metadata

Exif and XMP are both metadata standards used in digital imaging, but they serve different purposes and have distinct characteristics.

Exif Metadata

  • Origin: Developed by the Japan Electronic Industries Development Association (JEIDA) for use in digital cameras.
  • Content: Primarily contains technical information about the image, such as camera settings (aperture, shutter speed, ISO), date and time the photo was taken, and sometimes GPS coordinates.
  • Format: Binary format embedded directly within the image file (JPEG, TIFF, etc.).
  • Usage: Widely supported by digital cameras and image viewing/editing software. It is mainly used for storing camera-related information.

XMP Metadata

  • Origin: Developed by Adobe Systems as an open standard for metadata.
  • Content: Can store a wide range of information, including technical, descriptive, and administrative metadata. This includes editing history, keywords, author information, and more.
  • Format: XML-based, making it more flexible and extensible. XMP metadata can be embedded within the file or stored in a separate sidecar file.
  • Usage: Used extensively in professional photo editing software (like Adobe Photoshop and Lightroom) for managing and preserving metadata across different file formats and workflows.

Key Differences

  • Purpose: Exif is mainly for camera-specific information, while XMP is more versatile and can store a broader range of metadata.
  • Format: Exif is binary and embedded within the image file, whereas XMP is XML-based and can be embedded or stored separately.
  • Flexibility: XMP is more flexible and can be easily extended to include custom metadata fields, while Exif is more rigid and standardized.

Both Exif and XMP metadata are important for different aspects of digital imaging. Exif is useful for understanding the technical details of how an image was captured, while XMP provides a more comprehensive and flexible way to manage and preserve metadata throughout the editing and publishing process.

Conclusion

Now you know all about ExifTool! ExifTool is a powerful tool for anyone who wants to understand and manage the metadata within their digital files. It can be especially useful for photographers, videographers, and anyone who wants to keep their digital files well-organized.

Resource:

  • ExifTool Website

Related Read:

  • How To View Image Metadata On Linux

The above is the detailed content of How To Manage Image Metadata Using ExifTool In Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How to Use 'next' Command with Awk in Linux - Part 6How to Use 'next' Command with Awk in Linux - Part 6May 15, 2025 am 10:43 AM

In this sixth installment of our Awk series, we will explore the next command, which is instrumental in enhancing the efficiency of your script executions by skipping redundant processing steps.What is the next Command?The next command in awk instruc

How to Efficiently Transfer Files in LinuxHow to Efficiently Transfer Files in LinuxMay 15, 2025 am 10:42 AM

Transferring files in Linux systems is a common task that every system administrator should master, especially when it comes to network transmission between local or remote systems. Linux provides two commonly used tools to accomplish this task: SCP (Secure Replication) and Rsync. Both provide a safe and convenient way to transfer files between local or remote machines. This article will explain in detail how to use SCP and Rsync commands to transfer files, including local and remote file transfers. Understand the scp (Secure Copy Protocol) in Linux scp command is a command line program used to securely copy files and directories between two hosts via SSH (Secure Shell), which means that when files are transferred over the Internet, the number of

10 Most Popular Linux Desktop Environments of All Time10 Most Popular Linux Desktop Environments of All TimeMay 15, 2025 am 10:35 AM

One fascinating feature of Linux, in contrast to Windows and Mac OS X, is its support for a variety of desktop environments. This allows desktop users to select the most suitable and fitting desktop environment based on their computing requirements.A

How to Install LibreOffice 24.8 in Linux DesktopHow to Install LibreOffice 24.8 in Linux DesktopMay 15, 2025 am 10:15 AM

LibreOffice stands out as a robust and open-source office suite, tailored for Linux, Windows, and Mac platforms. It boasts an array of advanced features for handling word documents, spreadsheets, presentations, drawings, calculations, and mathematica

How to Work with PDF Files Using ONLYOFFICE Docs in LinuxHow to Work with PDF Files Using ONLYOFFICE Docs in LinuxMay 15, 2025 am 09:58 AM

Linux users who manage PDF files have a wide array of programs at their disposal. Specifically, there are numerous specialized PDF tools designed for various functions.For instance, you might opt to install a PDF viewer for reading files or a PDF edi

How to Filter Command Output Using Awk and STDINHow to Filter Command Output Using Awk and STDINMay 15, 2025 am 09:53 AM

In the earlier segments of the Awk command series, our focus was primarily on reading input from files. However, what if you need to read input from STDIN?In Part 7 of the Awk series, we will explore several examples where you can use the output of o

Clifm - Lightning-Fast Terminal File Manager for LinuxClifm - Lightning-Fast Terminal File Manager for LinuxMay 15, 2025 am 09:45 AM

Clifm stands out as a distinctive and incredibly swift command-line file manager, designed on the foundation of a shell-like interface. This means that users can engage with their file system using commands they are already familiar with.The choice o

How to Upgrade from Linux Mint 21.3 to Linux Mint 22How to Upgrade from Linux Mint 21.3 to Linux Mint 22May 15, 2025 am 09:44 AM

If you prefer not to perform a new installation of Linux Mint 22 Wilma, you have the option to upgrade from a previous version.In this guide, we will detail the process to upgrade from Linux Mint 21.3 (the most recent minor release of the 21.x series

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools