If you want to share some of your pictures over the internet but you are worried that they might have metadata like location embedded in them, here’s how to strip that data out on Linux.
First a few words aboutthe ExifTool by Phil Harvey. ExifTool is a widely used Perl-based tool to read, write and edit metadata in image files, that is available for Windows, Mac and Linux.
To install the ExifTool on linux use:
sudo apt-cache install libimage-exiftool-perl
View Image Metadata
To view a meta data of an image on Linux with ExifTool you can use the following commands:
To show meta data for a single .jpg image use:
To show meta data for all .jpg images in a current directory use:
exiftool -ext jpg
and to show meta data for all .jpg images in a directory AND subdirectories use:
exiftool -r -ext jpg .
Here is a sample of meta data inside a .jpg image extracted with ExifTools:
Remove Meta data from Picture
After checking the meta data of a picture you’ve taken yourself, you might be surprised to find out just how much information is stored in it, and you might want to remove all that meta data before posting your images online.
To remove all metadata of an image file:
exiftool -all= -overwrite_original photo.jpg
To remove all metadata of ALL .jpg image files in the current directory:
exiftool -all= -overwrite_original -ext jpg .
And to remove all metadata of ALL .jpg image files in the current directory AND subdirectories:
exiftool -all= -r -overwrite_original -ext jpg .
To remove just the GPS data from ALL .jpg images in a directory use:
exiftool -gps:all= *.jpg
TIP: The -ext jpg is case-sensitive. So, use -ext JPG or -ext jpeg or -ext png.