Created
June 16, 2019 14:57
-
-
Save ibressler/8684a6f97c6deb54b06a245eba3b0b88 to your computer and use it in GitHub Desktop.
fix exif metadata containing wrong keys and datetime with binary character
This file contains 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
fn="$1" | |
echo "fn: $fn" | |
[ -f "$fn" ] || exit 1 | |
str="$(exiv2 -p a "$fn" 2>&1 | grep -a Exif.Image.DateTime | grep -a -o '2019:.*$')" | |
#echo "'$str'" | |
# fix datatime first | |
exiv2 -M"set Exif.Image.DateTime $str" "$fn" | |
# extract all readable metadata (to .xmp file) | |
exiv2 -eaX "$fn" | |
# delete all metadata | |
exiv2 rm "$fn" | |
# restore metadata from file | |
exiv2 -iaX "$fn" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment