Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.


Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.


Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.


Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Security

Removing Metadata from Images

Submitted by on September 8, 2015 – 12:09 pm

Phones and cameras record a surprising amount of personally-sensitive information with the photos they create. This data includes timestamps, GPS coordinates, software used to process the images and lots of other details you may not want Google and Facebook to know when uploading your photos. Sometimes even emailing photos containing this sort of information can lead to awkward situations. It’s just better to remove all metadata from photos that leave your computer.

You will need ImageMagick and ExifTool. The latter requires Perl, which you probably already have, but may need to install.

yum -y install ImageMagick ImageMagick-devel perl-Image-ExifTool

Let’s say you have a folder with a bunch of JPEGs. You can view the metadata like so:
identify -verbose *.jpg

Metadata is useful for organizing your photos and you certainly need to make a backup copy of all the original images before removing metadata. So, one set will be for your personal archive and the metadata-less version will be for everyone else. The basic command to remove all metadata from all JPEG images in the current folder goes something like this:
exiftool -P -all= *.jpg

This command will create a backup copy called “*.jpg_original” for every file it modifies. If you already made backups, you can skip this step:
exiftool -P -overwrite_original -all= *.jpg

You can easily work this into a small shell script. The example below will find all JPEG files in your WordPress “uploads” directory and remove metadata (make a backup before you try this):
find /var/www/html/ -type f -iname "*\.jpg" -exec exiftool -P -overwrite_original -all= {} \;

Keep in mind that certain applications (including WordPress plugins) may use metadata to organize your images. Removing this metadata may cause some excitement. It’s the usual balance between security and convenience.

Print Friendly, PDF & Email

Leave a Reply