mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-09 14:48:08 -05:00
[privacy] Add strip_image_metadata script
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,6 +9,7 @@
|
||||
.DS_Store
|
||||
.#*
|
||||
*.profraw
|
||||
*_original
|
||||
|
||||
/vendor/*
|
||||
/target/*
|
||||
|
||||
48
contrib/privacy/strip_image_metadata.sh
Executable file
48
contrib/privacy/strip_image_metadata.sh
Executable 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
|
||||
|
||||
Reference in New Issue
Block a user