How to scrub sensitive photo metadata using ExifTool
Protect your privacy while retaining image settings
Modern cameras store a lot of information in each photo: important stuff like the shutter speed and camera model, but also less well known things like your location and the serial number of your lens.
When I made the photo gallery on this site, I wanted to remove metadata that identifies specific devices I own or people I know. But I didn’t like the idea of removing the capture settings too, since those might be useful for other photographers. (This is also why I don’t minify this site.)
I’m now using the following ExifTool command on all photos before I share them. It’s in my .bashrc
to make things more convenient:
alias exifscrub_destructive="exiftool -overwrite_original -LensIDNumber= -SerialNumber= -LensSerialNumber= -ShutterCount= -Keywords= -Subject= -ThumbnailImage= -PhotoshopThumbnail= -XMP:All= "
# usage: exifscrub_destructive *.jpg
Here’s what each option means:
-overwrite_original
: Modify the original photo instead of creating a copy.-LensIDNumber=
(Nikon),-LensSerialNumber=
(Fujifilm), and-SerialNumber=
: Remove lens and camera body serial numbers.-ShutterCount=
: This is the number of photos taken on your camera so far. Since it increases monotonically and is highly predictable, it might be used to deanonymize cameras even without the serial number.-Keywords= -Subject=
: Some programs use these fields to store the names of people you’ve tagged in the photo.-ThumbnailImage= -PhotoshopThumbnail=
: To save space, remove thumbnail images.-XMP:All=
: Lightroom uses XMP to store the edits you’ve applied and the photo’s document ID. I wasn’t sure whether this is sensitive information, so I am removing all XMP stuff to be safe. Also it shaves another few kilobytes off the file size.
These options worked on photos from my Nikon D5100. Your camera might store things differently, so please let me know if I missed anything!
Update on 30 May 2017: Add -LensSerialNumber=
argument.