Image metadata is information that is embedded into files like jpeg, tiff, and other common formats. The primary form of metadata used in photos is called EXIF (Exchangeable Image File Format). This data can contain supplemental information for the image, such as the date and time that the photo was taken, with what camera model, GPS info, author, copyright information, and more.
This kind of metadata comes in handy when you need to determine additional information about an image, such as who the original author is. It is also possible to manually add or edit metadata to an image file. In this tutorial, you will learn how to get and change image metadata on a Linux system. This can be accomplished from the command line with the ExifTool program. We will cover usage examples below.
In this tutorial you will learn:
- What is image EXIF metadata?
- How to install ExifTool on major Linux distros
- How to use ExifTool to get and change image metadata
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Get and change image metadata – command line
You have a few options when it comes to handling EXIF metadata for images on the command line. One of our favorite tools for the job is ExifTool, which can be easily installed on all major Linux distros. Let’s first start by installing the program.
How to install ExifTool
You can use the appropriate command below to install ExifTool with your system’s package manager.
$ sudo apt install libimage-exiftool-perl
$ sudo dnf install perl-Image-ExifTool
$ sudo pacman -S perl-image-exiftool
ExifTool usage examples
Now that ExifTool has been installed, let’s see how to use the command in order to get and change image metadata. Check out some of the examples below and adapt them to fit your own situation as needed.
- To see all of the metadata for an image, just use the
exiftoolcommand and specify the file name of your image.
$ exiftool image.jpg
- You can also get the metadata for multiple images at once:
$ exiftool image1.jpg image2.jpg image3.jpg OR $ exiftool image*.jpg
- To see the metadata for a specific EXIF field, you can enter the field you want to see as an option passed to
exiftool. For example, to see the camera model that was used to capture an image:
$ exiftool -model image.jpg Camera Model Name : iPhone 12 Pro Max
- To edit the metadata of an image, specify the field or fields you wish to modify, along with what information you want to insert. For example, to add information to the
$ exiftool -author="linuxconfig" image.jpg 1 image files updated
- You can also edit multiple fields simulataneously. For example, let’s edit the
$ exiftool -author="linuxconfig" -title="Linux penguin" image.jpg 1 image files updated
- In case you need to remove the data from a field, use the same syntax as above but do not specify any information:
$ exiftool -author= image.jpg
- You can also remove all of the metadata from an image file:
$ exiftool -all= image.jpg
In this tutorial, we saw how to get and change image metadata on a Linux system. This is accomplished with the ExifTool command line program, which can be installed from the official software repositories on all major Linux distros. We have covered a lot of the essential usage of
exiftoolin this tutorial, but you should check the manual page for further options.