1
0
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Scripts/remove-orientation.sh

29 lines
781 B

#!/bin/bash
# Remove orientation information from the EXIF metadata WITHOUT touching pixels.
# Can also remove thumbnail because some programs like Ristretto are bugged by
# the remaining thumbnail orientation metadata. Useful when a photo has wrong
# orientation metadata (e.g. buggy LineageOS app).
usage() {
echo "Usage: $0 [-t] [FILE]"
echo " -t remove thumbnail"
}
OPT_FLAG_T=
while getopts "ht" OPTION; do
case $OPTION in
h) usage; exit 0 ;;
t) OPT_FLAG_T=true ;;
*) usage; exit 1 ;;
esac
done
shift $(( OPTIND - 1 ))
for jpg in "$@"; do
echo "Fixing \"$jpg\"…"
exiftool -Orientation= -overwrite_original "$jpg"
if [[ "$OPT_FLAG_T" = true ]]; then
exiftool -IFD1:all= -overwrite_original "$jpg"
fi
done