ImageMagick: How to Strip Metadata from an Image

Updated

Learn how to strip metadata like GPS and EXIF from an image using ImageMagick

ImageMagick: How to Strip Metadata from an Image

Before we start, make sure you have ImageMagick installed on your computer and your photo ready in a folder. If you don't have it yet, run this command:

brew install imagemagick

First, open your terminal and navigate to the folder that has your photo. To see what's hiding inside it, run this command:

magick identify -verbose input.jpg | grep -i gps

If your photo has a location, you'll see the GPS coordinates. To remove it, run this command:

magick input.jpg -strip output.jpg

Just remember to replace input.jpg with your actual filename. The -strip option removes the EXIF data, the GPS coordinates, the camera details, the comments and the embedded color profile. Don't worry if you don't see a success message, the command finishes quietly.

To make sure everything worked, run magick identify -verbose output.jpg | grep -i gps. If nothing comes back, the data is gone.

One more tip: to clean the original file instead of making a copy, use magick mogrify -strip input.jpg. It overwrites the file, so keep a backup if you need the metadata later.