Linux: Command to View/Delete Metadata in Image Files

By Xah Lee. Date: . Last updated: .

This page shows you how to use the Linux command line tool to view or delete data such as {date, GPS location, …} that are embedded in image files.

ExifTool

ExifTool is a widely used tool for {read, write, edit} metadata in image files. It's available for {Windows, Mac, Linux}.

Install Exiftool

# install exiftool
sudo apt-cache install libimage-exiftool-perl

For Mac, Microsoft Windows, see ExifTool home page at http://owl.phy.queensu.ca/~phil/exiftool/

View Metadata

How to view metadata of image file?

# show metadata of a image file
exiftool myPhoto.jpg
# show metedata for all *jpg files in current dir
exiftool -ext jpg
# show metedata for all *jpg files in current dir and subdirs
exiftool -r -ext jpg .

Here's sample metadata in jpg file and mp3 file:

On Linux, type man exiftool to view its doc. Here's a text copy: exiftool_man_page.txt

Remove Metadata

How to remove metadata of a image file?

# remove all metadata of a image file
exiftool -all= -overwrite_original photo.jpg
# remove all metadata of all *jpg files in current dir
exiftool -all= -overwrite_original -ext jpg .
# remove metedata for all *jpg files in current dir and subdirs
exiftool -all= -r -overwrite_original -ext jpg .

The -ext jpg is case-sensitive. So, you might use -ext JPG or -ext jpeg or -ext png.

How to remove just GPS data?

# remove all GPS metadata of *jpg files in current dir
exiftool -gps:all= *.jpg

ImageMagick 「identify -verbose」

A alternative to exiftool is ImageMagick identify -verbose.

See also: ImageMagick Tutorial.

2013-10-24 thanks to Nick Alcock

Metadata is also stored is various different formats, for files other than image files. For example, video files, and even text files. Two popular general-purpose metadata formats are: IPTC, XMP. There's also the ID3 format for MP3 audio files. There's also Mac OS X Extended Attributes.