1
0
Fork 0

remove-orientation.sh

This commit is contained in:
dece 2023-09-17 16:11:15 +02:00
parent 08f2735f82
commit 5a18b172cc

28
remove-orientation.sh Executable file
View file

@ -0,0 +1,28 @@
#!/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