Command to View/Delete Metadata in Image Files

By Xah Lee. Date: . Last updated: .

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

ExifTool

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

Install

ExifTool home page at https://exiftool.org/

View Metadata

# show metadata of a image file
exiftool xyz.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:

Remove Metadata

# remove all metadata of a image file
exiftool -all= -overwrite_original xyz.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.

Remove just GPS data

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

Exiftool Manual


2013-10-24 thanks to Nick Alcock

Metadata outside images, IPTC, XMP, etc.

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.

Image Tutorial