[privacy] Add strip_image_metadata script

This commit is contained in:
y
2023-11-09 15:57:37 -05:00
parent 13a18f3ca5
commit d17933867f
2 changed files with 49 additions and 0 deletions

1
.gitignore vendored
View File

@@ -9,6 +9,7 @@
.DS_Store
.#*
*.profraw
*_original
/vendor/*
/target/*

View File

@@ -0,0 +1,48 @@
#!/usr/bin/env sh
: '
Requirements: `exiftool`
This script makes use of exiftool to remove metadata from a file.
Undesirable metadata might include author, operating system,
version of image editor used to create an image, geolocation, etc.
Often this information is present in files without our knowledge
or assent so it is a good idea to proactively remove it using
this script of exiftool directly.
Exiftool works well for removing metadata from images. However,
it cannot completely remove metadata from PDFs. See the exiftool
docs for more information.
This script should be run before a file is committed to
the repository.
It can be run non-destructively as exiftool will create a copy
of the original file and preserve it with the string "_original"
appended to the end.
e.g. `test.jpg` as input to exiftool will create `test.jpg_original`.
This script is simple and removes metadata only from a single file.
However, it is absolutely possible to use exitool in conjunction with
`find` and a `for` loop to remove metadata, either using this tool
or with exiftool directly.
'
set -e
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <file>"
exit 1
fi
FILE="$1"
if ! [ -f $FILE ]; then
echo "Target should be a file"
exit 2
else
exiftool -all= $FILE
fi