How to strip Image metadata in Ubuntu/Linux

If you want to post some pictures but you’re worried that they might have metadata like location embedded in them, here’s how to strip that data out.

First, install exiftool using this command:

sudo apt-get install libimage-exiftool-perl

Then, go into the directory with the JPEG files. If you want to remove metadata from every file in the directory, use

exiftool -all= *

The exiftool will make copies, so if you had a file called image.jpg, when you’re done you’ll have image.jpg with all the metadata stripped plus a file called image.jpg_original which will still have the metadata.

Sometimes, it is a good idea to scrub EXIF metadata from photos before sharing them, and there is no better tool for the job than exiftool. The command below nukes all EXIF metadata in a photo in one fell swoop (replace foo.jpg with the actual file name):
exiftool -all= foo.jpg
This command removes EXIF metadata from the specified photo, but what if you need to process multiple photos? Then you can use the following command which cleans all the photos in the current directory:
for i in *.jpg; do echo "Processing $i"; exiftool -all= "$i"; done
Instead of purging all EXIF metadata from a photo, you can also remove individual fields. For example, the following command can come in handy when you need to remove geographical coordinates embedded in the photo:
exiftool -geotag= foo.jpg
And the command below can help you to remove geotags from multiple photos in one go:
for i in *.jpg; do echo "Processing $i"; exiftool -geotag= "$i"; done

Rezie image

mogrify * -quality 75 -resize "450x450" *

Share this

Related Posts

Next Post »