created own version of exifautotran (placed into utils), and call it from ./ in non PROD and explciti /code in PROD - it deals with the Samsung created images with invalid SOS which dont autorotate

This commit is contained in:
2022-08-02 18:47:24 +10:00
parent 5221e330c1
commit 91b5e1b6d2
2 changed files with 44 additions and 1 deletions

40
utils/pa_exifautotran Executable file
View File

@@ -0,0 +1,40 @@
#!/bin/sh
# pa_exifautotran [list of files]
#
# Transforms JPEG files so that Exif Orientation becomes 1
#
# blatant copy of exitautotran shell script with:
# Minor change made to ignore failure of jpegtran (it was failing
# b/c Samsung images are incomplete, but the rotation works)
for i
do
case $i in
-v|--version) echo "$0 (pa variant)"; exit 0;;
-h|--help)
cat <<EOF
$0 [list of files]
Transforms JPEG files so that Exif Orientation becomes 1
EOF
exit 0;;
esac
case $(exiftool -t -s -s -s -n -IFD0:Orientation -IFD1:Orientation "$i") in
1) transform="";;
2) transform="-flip horizontal";;
3) transform="-rotate 180";;
4) transform="-flip vertical";;
5) transform="-transpose";;
6) transform="-rotate 90";;
7) transform="-transverse";;
8) transform="-rotate 270";;
*) transform="";;
esac
if test -n "$transform"; then
echo Executing: jpegtran -copy all $transform "$i" >&2
jpegtran -copy all $transform "$i" > tempfile
rm "$i"
mv tempfile "$i"
jpegexiforient -1 "$i"
fi
done