2022-03-17 10:14:08 +01:00
|
|
|
#!/bin/bash
|
2021-02-22 21:09:50 +01:00
|
|
|
|
|
|
|
if [[ -z $1 ]] && [[ -z $2 ]]; then
|
2022-02-17 13:45:43 +01:00
|
|
|
echo "Usage: heif-convert <filename> <output>" 1>&2
|
2021-02-22 21:09:50 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-02-17 13:45:43 +01:00
|
|
|
# Usage: heif-convert [-q quality 0..100] <filename> <output>
|
2021-02-22 21:09:50 +01:00
|
|
|
|
2021-05-20 11:44:55 +02:00
|
|
|
/usr/bin/heif-convert -q 92 "$1" "$2"
|
|
|
|
|
|
|
|
# Reset Exif orientation flag if output image was rotated based on "QuickTime:Rotation"
|
|
|
|
|
2022-03-16 19:09:53 +01:00
|
|
|
if [[ $(/usr/bin/exiftool -n -QuickTime:Rotation "$1") ]]; then
|
2022-01-06 09:55:41 +01:00
|
|
|
/usr/bin/exiftool -overwrite_original -P -n '-ModifyDate<FileModifyDate' -Orientation=1 "$2"
|
|
|
|
else
|
|
|
|
/usr/bin/exiftool -overwrite_original -P -n '-ModifyDate<FileModifyDate' "$2"
|
|
|
|
fi
|