2

Use ExifTool to remove private data in images

 10 months ago
source link: https://akrabat.com/use-exiftool-to-remove-private-data-in-images/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Use ExifTool to remove private data in images

I’m a huge fan of ExifTool for manipulating EXIF data in images as it really is the Swiss Army knife for all things metadata related with images.

Recently, I wanted to strip some privacy-related metadata from some photos; specifically location, people and keywords. That is, I wanted to keep the title, the camera settings, the creator, and so on, but remove information that pertains to people and place.

This is the script that I wrote:

#!/usr/bin/env bash

# Remove all keywords, rating, people and location data
exiftool \
    -overwrite_original \
    -m \
    -r \
    -keywords= -Subject= \
    -Rating= \
    -RegionInfoMP= -RegionInfo= -imageregion= -PersonInImage= \
    -Location= -gps:all= -City= -State= -Sub-location= \
    -IPTCDigest= \
    "$1"

echo "All keywords, people and location data removed from $1"

To remove metadata fields from an image with ExifTool, you use the format -{NameOfField} flag and set it equal to nothing. To find the name of the fields you want to clear, use:

exiftool -J {filename}

This prints out all the metadata in JSON format which provides the internal field name that you need to use for the parameter flag.

I also set -r so that it will processes all images in a directory if I pass a directory name to this script. Also, note that I use -overwrite_original because I trust the tool and can always re-export the photo anyway. Use this flag at your own risk!

I added a little automation with Keyboard Maestro and now have a hotkey that I can use in Finder to strip this data from my image before sending it on.

This article was posted on 15 August 2023 in Photography, Software

Thoughts? Leave a reply Cancel reply

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

Comment *

Name *

Email *

Website

Post navigation


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK