Linux: Command to View/Delete Metadata in Image Files
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 home page at https://exiftool.org/
View Metadata
# 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:
- exiftool sample output on JPG file: metadata_sample_exif.txt
- exiftool sample output on MP3 file: metadata_sample_id3.txt
Remove Metadata
# 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
.
Remove just GPS data
# remove all GPS metadata of *jpg files in current dir exiftool -gps:all= *.jpg
Exiftool Manual
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.
If you have a question, put $5 at patreon and message me.