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.
Table of Contents
- What’s Inside EXIF Data
- Tool 1 - ExifTool (Most )
- Tool 2 - mat2 (Documents and Images)
- Tool 3 - ImageMagick (If You’re Already Using It)
- Automated Removal with inotifywait (Linux)
- Automated Removal on macOS with Folder Actions
- Verify Before Sharing
- Handling HEIC and RAW Formats
- What Metadata Stripping Does Not Remove
- Integration with Photo Workflows
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
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
Handling HEIC and RAW Formats
HEIC (the default iPhone format since iOS 11) and camera RAW files carry metadata just like JPEG, but some tools handle them poorly.
HEIC Files
ExifTool handles HEIC fully:
Strip all metadata from HEIC
exiftool -all= -overwrite_original photo.heic
Batch process HEIC files
exiftool -all= -overwrite_original -ext heic /path/to/photos/
Convert HEIC to JPEG while stripping metadata
exiftool -all= -o cleaned.jpg photo.heic
mat2 and ImageMagick have incomplete HEIC support on some platforms. Stick with ExifTool for HEIC.
Camera RAW Formats (CR2, NEF, ARW, DNG)
RAW files contain extensive embedded metadata. camera settings, GPS, lens profiles, and in some cases the photographer’s name from camera registration:
Check what's in a RAW file
exiftool photo.cr2 | grep -E "GPS|Owner|Artist|Copyright|Serial"
Strip from Canon CR2
exiftool -all= -overwrite_original photo.cr2
Strip from Nikon NEF
exiftool -all= -overwrite_original photo.nef
Strip from Sony ARW
exiftool -all= -overwrite_original photo.arw
Batch - all RAW formats in a directory
exiftool -all= -overwrite_original -ext cr2 -ext nef -ext arw -ext dng /path/to/photos/
One important caveat - stripping RAW metadata removes lens correction profiles and color calibration data that editing software uses. Strip RAW files only after editing is complete, or export a stripped JPEG/TIFF for sharing instead of the RAW file.
What Metadata Stripping Does Not Remove
Metadata stripping removes EXIF, IPTC, and XMP tags embedded in the file. It does not remove:
Steganographic data - Some apps embed invisible watermarks in pixel data that survive metadata removal. These are used by stock photo agencies and some social platforms. ExifTool cannot detect or remove these.
Platform-added metadata - Some social platforms re-add metadata when you download a photo from their site. A photo you uploaded stripped of EXIF may have location data re-embedded by the platform based on your account information. Always verify after downloading from platforms.
Image content itself - If a photo shows street signs, landmarks, or recognizable locations, metadata removal doesn’t help. The image content is the data.
Thumbnails embedded in EXIF - Some cameras embed a full-resolution thumbnail inside the EXIF data. ExifTool removes these by default when you strip all metadata with -all=, but targeted removals (like only removing GPS) may leave the thumbnail intact with its own embedded GPS:
Explicitly remove thumbnails when doing partial strips
exiftool -GPS:all= -ThumbnailImage= -overwrite_original photo.jpg
Integration with Photo Workflows
Lightroom / Capture One Export
Both Lightroom and Capture One can strip metadata at export time without a separate tool:
In Lightroom - File → Export → Metadata section → uncheck “Include: All Metadata” → select “Copyright Only” or “Copyright & Contact Info Only”
In Capture One - Export → Metadata → “Strip All Metadata” or custom selection
This is the cleanest approach for photographers. strip at the point of export rather than as a post-processing step.
Git Pre-Commit Hook for Developers
If you commit images to a repository, add a pre-commit hook to catch unstripped photos:
#!/bin/bash
.git/hooks/pre-commit
Check staged image files for GPS metadata
staged_images=$(git diff --cached --name-only --diff-filter=A | grep -iE '\.(jpg|jpeg|png|heic)$')
for img in $staged_images; do
gps=$(exiftool -GPS:all "$img" 2>/dev/null | grep -c "GPS")
if [ "$gps" -gt 0 ]; then
echo "ERROR: $img contains GPS metadata. Strip before committing."
exit 1
fi
done
exit 0
chmod +x .git/hooks/pre-commit
This blocks commits containing GPS-tagged images, which is particularly relevant for repositories with location-sensitive content.
Frequently Asked Questions
Who is this article written for?
This article is written for developers, technical professionals, and power users who want practical guidance. Whether you are evaluating options or implementing a solution, the information here focuses on real-world applicability rather than theoretical overviews.
How current is the information in this article?
We update articles regularly to reflect the latest changes. However, tools and platforms evolve quickly. Always verify specific feature availability and pricing directly on the official website before making purchasing decisions.
Are there free alternatives available?
Free alternatives exist for most tool categories, though they typically come with limitations on features, usage volume, or support. Open-source options can fill some gaps if you are willing to handle setup and maintenance yourself. Evaluate whether the time savings from a paid tool justify the cost for your situation.
How do I get started quickly?
Pick one tool from the options discussed and sign up for a free trial. Spend 30 minutes on a real task from your daily work rather than running through tutorials. Real usage reveals fit faster than feature comparisons.
What is the learning curve like?
Most tools discussed here can be used productively within a few hours. Mastering advanced features takes 1-2 weeks of regular use. Focus on the 20% of features that cover 80% of your needs first, then explore advanced capabilities as specific needs arise.
Related Articles
- How to Remove EXIF Metadata from Photos Before Sharing
- Mobile Photo Metadata Exif Location Data How To Strip
- Dating App Photo Metadata Stripping How To Remove Exif Gps
- Using exiftool on photos:
- Metadata Removal Tools Comparison 2026: ExifTool vs MAT2
- AI Coding Assistant Session Data Lifecycle Built by theluckystrike. More at zovo.one