29 lines
781 B
Bash
Executable file
29 lines
781 B
Bash
Executable file
#!/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
|