EXIF metadata in photos can expose your GPS coordinates, device model, serial number, and exact timestamp. A photo posted online with intact metadata tells anyone who downloads it exactly where it was taken. This guide covers tools to strip EXIF data from single files, batches, and automatically from a watched directory.
What’s Inside EXIF Data
Run this on any photo to see what’s stored:
exiftool photo.jpg
Output often includes:
GPS Latitude : 48 deg 51' 30.00" N
GPS Longitude : 2 deg 17' 40.00" E
GPS Position : 48 deg 51' 30.00" N, 2 deg 17' 40.00" E
Make : Apple
Camera Model Name : iPhone 15 Pro
Lens ID : iPhone 15 Pro back triple camera
Software : 17.3.1
Create Date : 2026:02:14 15:23:07
Owner Name : John Smith
Serial Number : F1TL23456789
Some of this is harmless. GPS coordinates, device serial numbers, and owner names are not.
Tool 1: ExifTool (Most )
ExifTool is the most complete metadata tool available — it handles over 100 file formats.
# Install
sudo apt install libimage-exiftool-perl # Debian/Ubuntu
sudo dnf install perl-Image-ExifTool # Fedora
brew install exiftool # macOS
Remove All Metadata From One File
# Strips everything, overwrites in place
exiftool -all= photo.jpg
# ExifTool creates a backup as photo.jpg_original by default
# Remove the backup when done
rm photo.jpg_original
# Or suppress the backup
exiftool -all= -overwrite_original photo.jpg
Remove All Metadata — Keep a Copy
# Write cleaned version to a new file
exiftool -all= -o cleaned_photo.jpg photo.jpg
Batch Process a Folder
# Strip all metadata from every JPG and PNG in a folder
exiftool -all= -overwrite_original /path/to/photos/*.jpg
exiftool -all= -overwrite_original /path/to/photos/*.png
# Recursive (includes subfolders)
exiftool -all= -overwrite_original -r /path/to/photos/
# Process multiple file types at once
exiftool -all= -overwrite_original -ext jpg -ext png -ext heic /path/to/photos/
Keep Useful Non-Identifying Tags
Remove only sensitive tags while keeping useful ones like image dimensions:
# Remove GPS and serial number, keep everything else
exiftool -GPS:all= -SerialNumber= -OwnerName= -overwrite_original photo.jpg
# Remove GPS from a whole folder
exiftool -GPS:all= -overwrite_original -r /path/to/photos/
Check What Remains
After stripping, verify the output:
exiftool -overwrite_original -all= photo.jpg
exiftool photo.jpg | grep -E "GPS|Serial|Owner|Software|Device"
# Should return nothing
Tool 2: mat2 (Documents and Images)
mat2 handles images but also strips metadata from PDFs, Office documents, audio files, and archives — useful when you share more than just photos.
# Install
sudo apt install mat2 # Debian/Ubuntu
pip install mat2 # If apt version is outdated
Strip Metadata
# Process a single file
mat2 photo.jpg
# mat2 creates a cleaned file with .cleaned extension by default
# photo.jpg → photo.cleaned.jpg
# Process a folder
mat2 --inplace /path/to/photos/*.jpg
# Check metadata in a file
mat2 --check photo.jpg
Process Multiple File Types
# Strip from PDF
mat2 document.pdf
# Strip from audio files
mat2 recording.mp3
# Process everything in a directory (image + document types)
for f in /path/to/files/*; do
mat2 --inplace "$f" 2>/dev/null && echo "Cleaned: $f"
done
Tool 3: ImageMagick (If You’re Already Using It)
If you’re already processing images with ImageMagick, strip metadata in the same step:
# Install
sudo apt install imagemagick
# Strip all profiles/metadata during conversion
convert -strip input.jpg output.jpg
# Resize and strip simultaneously (useful for web uploads)
convert input.jpg -resize 1920x1920\> -strip -quality 85 output.jpg
# Batch process with mogrify (modifies in place)
mogrify -strip /path/to/photos/*.jpg
Note: ImageMagick removes most EXIF but doesn’t always remove every metadata field. Use ExifTool for thorough stripping.
Automated Removal with inotifywait (Linux)
Set up a folder watcher that strips EXIF from any photo dropped into a “clean” folder:
# Install inotify-tools
sudo apt install inotify-tools exiftool
Create the watcher script at /usr/local/bin/exif-watcher.sh:
#!/bin/bash
WATCH_DIR="$HOME/Pictures/clean-queue"
OUTPUT_DIR="$HOME/Pictures/cleaned"
LOG_FILE="$HOME/.exif-watcher.log"
mkdir -p "$WATCH_DIR" "$OUTPUT_DIR"
echo "$(date): Starting EXIF watcher on $WATCH_DIR" >> "$LOG_FILE"
inotifywait -m -e close_write "$WATCH_DIR" | while read -r dir events filename; do
filepath="$dir$filename"
ext="${filename##*.}"
ext_lower=$(echo "$ext" | tr '[:upper:]' '[:lower:]')
# Only process image types
if [[ "$ext_lower" =~ ^(jpg|jpeg|png|heic|tiff|webp)$ ]]; then
output_file="$OUTPUT_DIR/$filename"
exiftool -all= -o "$output_file" "$filepath"
echo "$(date): Cleaned $filename → $output_file" >> "$LOG_FILE"
fi
done
Make it executable and start it:
chmod +x /usr/local/bin/exif-watcher.sh
nohup /usr/local/bin/exif-watcher.sh &
To start it on login, add to ~/.bashrc or create a systemd user service.
Systemd User Service
Create ~/.config/systemd/user/exif-watcher.service:
[Unit]
Description=EXIF Metadata Watcher
After=default.target
[Service]
ExecStart=/usr/local/bin/exif-watcher.sh
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.target
Enable:
systemctl --user enable --now exif-watcher.service
systemctl --user status exif-watcher.service
Automated Removal on macOS with Folder Actions
On macOS, use Automator or a launchd plist to watch a folder:
# Create a script
cat > ~/clean-exif.sh << 'EOF'
#!/bin/bash
for file in "$@"; do
ext="${file##*.}"
case "${ext,,}" in
jpg|jpeg|png|heic|tiff)
exiftool -all= -overwrite_original "$file"
echo "Cleaned: $file"
;;
esac
done
EOF
chmod +x ~/clean-exif.sh
In Automator:
- New Folder Action
- Choose the target folder
- Add action: “Run Shell Script”
- Pass input “as arguments”
- Paste:
~/clean-exif.sh "$@"
Verify Before Sharing
Always check a file before posting it publicly:
# Quick check for GPS specifically
exiftool photo.jpg | grep -i gps
# Should return nothing after cleaning
# Full metadata check
exiftool photo.jpg
# Compare number of metadata fields before and after
Online tools for verification (for spot-checks):
https://www.metadata2go.comhttps://exifdata.com
Related Articles
- How to Remove EXIF Metadata from Photos Before Sharing
- Dating App Photo Metadata Stripping How To Remove Exif Gps D
- How To Remove Personal Photos From Google Images And Reverse
- Mobile Photo Metadata Exif Location Data How To Strip Before
- How To Remove Personal Data From Chatgpt Bing Ai And Google
Built by theluckystrike — More at zovo.one