/usr/lib/geeqie/geeqie-rotate is in geeqie-common 1:1.1-8.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | #!/bin/sh
# This is a helper script that rotate image files according to the metadata
# requirements: ImageMagick, exiftran, exiv2
GQ_METADATA_DIR="$HOME/.local/share/geeqie/metadata"
rotate()
{
ext=`echo "${1##*.}" |tr "[:upper:]" "[:lower:]"`
[ "x$ext" = "x" ] && return 1 #no extension
gq_metadata="$GQ_METADATA_DIR/$1.gq.xmp"
if [ -f "$gq_metadata" ]; then
gq_orientation=`exiv2 -PXkv "$gq_metadata"|grep Xmp.tiff.Orientation|sed -e "s|Xmp.tiff.Orientation *||"`
else
gq_orientation=
fi
case "$ext" in
jpg|jpeg)
[ -n "$gq_orientation" ] && exiv2 -M "set Exif.Image.Orientation $gq_orientation" "$1"
if exiftran -aip "$1" ; then
# exiftran ignores xmp, set it manually
exiv2 -M "set Xmp.tiff.Orientation 1" "$1"
#http://dev.exiv2.org/issues/show/639
[ -n "$gq_orientation" ] && exiv2 -M "set Xmp.tiff.Orientation 1" \
-M "set Exif.Image.Orientation 1" "$gq_metadata"
return 0
fi
;;
tif|tiff|png)
[ -n "$gq_orientation" ] && exiv2 -M "set Exif.Image.Orientation $gq_orientation" "$1"
if mogrify -auto-orient "$1" ; then
# mogrify ignores xmp, set it manually
exiv2 -M "set Xmp.tiff.Orientation 1" "$1"
#http://dev.exiv2.org/issues/show/639
[ -n "$gq_orientation" ] && exiv2 -M "set Xmp.tiff.Orientation 1" \
-M "set Exif.Image.Orientation 1" "$gq_metadata"
return 0
fi
;;
*) #not supported
return 0
;;
esac
}
get_sidecars=
if [ "x$1" = "x-g" ] ; then
get_sidecars=yes
shift
fi
# iterate over files on commandline
for file in "$@" ; do
if [ -n "$get_sidecars" ] ; then
# we got only one file for each group, typically the main one
# get the sidecars:
geeqie -r --get-sidecars:"$file" |while read sidecar ; do
# the main file is included in the sidecar file list, no special handling is required
rotate "$sidecar"
done
else
rotate "$file"
fi
done
|