Last active
June 4, 2023 14:12
-
-
Save ryanburnette/9890ab91cf1e32ceab52031cdf4df35c to your computer and use it in GitHub Desktop.
Remove rotation jpeg exif/meta and resave the file without it. Requires imagemagick and exiftool. https://ryanburnette.com/blog/imageoptim-rotation-information-loss/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -z "$1" ]; then | |
echo "Usage: $0 <directory>" | |
exit 1 | |
fi | |
dir="$1" | |
if [ ! -d "$dir" ]; then | |
echo "Error: '$dir' is not a directory" | |
exit 2 | |
fi | |
for file in "$dir"/*.jpg; do | |
if [ -f "$file" ]; then | |
echo "Processing: $file" | |
mogrify -auto-orient "$file" | |
exiftool -Orientation= -n -overwrite_original "$file" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment