How to Remove Exif Data via Linux Command Line

Images that contain Exif metadata may reveal when and where a photo was taken and with what device, among other things. While this is usually a desirable feature, it can also be a privacy concern if the images are going to be shared or published online. Exif data also helps inflate file size. In this guide, we’ll see how to remove EXIF data from JPG, JPEG, PNG, and other image files from the Linux command line.

There are quite a few tools available that can remove Exif data, but one we’ve found to work very well is ExifTool. This program can strip Exif metadata without recompressing the image, so there’s no loss in quality. There are a variety of options that can be used with the program, such as exporting a new version of the image (without the Exif data) or simply resaving the image in-place. We’ll show you all the most useful commands below.

Downloading ExifTool

You can download this program from the ExifTool website or use the appropriate command below to install it with your system’s package manager.

Ubuntu, Debian, and Linux Mint:

$ sudo apt install libimage-exiftool-perl

Fedora, AlmaLinux, CentOS, and RHEL:

$ sudo dnf install perl-Image-ExifTool

Arch Linux and Manjaro:

$ sudo pacman -S perl-image-exiftool

ExifTool Command Examples

Once ExifTool has been installed, use some of the example commands below in order to remove Exif data. These commands assume that you’ve already changed directories to where your images files are saved.

1. View all the metadata for an image file by using the following command.

$ exiftool image.jpg

2. Use the -all option to remove all metadata from a file. This command will save a new copy of your file, with the metadata removed. The original file will be renamed, with “_original” appended to the end of it.

$ exiftool -all= image.jpg

3. Use the -EXIF option to remove Exif data only from a file.

$ exiftool -EXIF= image.jpg

4. Use the -overwrite_original option to remove all metadata without saving the backup files.

$ exiftool -overwrite_original -all= image.jpg

5. Use the -recurse option to instruct ExifTool to traverse subdirectories. Specify the name of the directory and it’ll clear the metadata for every image file found inside.

$ exiftool -recurse -all= images-folder

6. Use a wildcard and the following options to clear all metadata for all images and those found inside subdirectories. If you’re wary of using it, omit the -overwrite_original option.

$ exiftool -overwrite_original -recurse -all= *

7. To see all the other options for ExifTool, check the man page.

$ man exiftool

Also check out our guide on how to losslessly compress JPG images via Linux command line if you want to reduce the file sizes of your pictures without any quality loss.

If our content helped you, please consider buying us a coffee. We appreciate your support!

Buy me a coffee donation button

Leave a Comment

Your email address will not be published. Required fields are marked *