#!/bin/sh # # This script will copy rotated photos to other directory # and remove Orientation EXIF tag from them. # It can be used for identify bad edited images - manually rotated w/o changing EXIF data. # This script doesn't write to source files. # # After run you can view photos in $DST and than remove Orientation header from these files: # find $DST -type f -iname "*.jpg" -exec exif -t Orientation --remove -o "{}" "{}" \; # and than view again. # # jc for http://piwigo.org/forum/viewtopic.php?id=19787 SRC='/home/user/fotos/Directory' DST='/home/user/fotos/_tmp/rotated' #FIND_EXCLUDE='! -path "_del" ! -path "_new" ! -path "_tmp"' # Spusteno s parametrem - zacneme analyzovat soubor if [ $# -gt 0 ]; then # Varianta 1 - exif binary EXIF=`exif -m --ifd=0 -t Orientation "$*" 2> /dev/null` # is there an exif? if [ $? -eq 0 ]; then if [ "${EXIF}" != "Top-left" ] && [ "${EXIF}" != "Unknown value 0" ]; then echo "ROTATED: $* ($EXIF)" cp -a "$*" "${DST}" FILE=`basename "$*"` exif -t Orientation --remove -o "${DST}/${FILE}" "${DST}/${FILE}" > /dev/null # else # echo "OK: $* ($EXIF)" fi fi # Varianta 2 - exiftool binary (pretty slow) #EXIF='' #EXIF=`exiftool -Orientation --struct "$*"|grep Rotate` #if [ "${EXIF}" != "" ]; then # echo "ROTATED: $*" #fi else # Spusteno bez parametru - najdeme soubory v $SRC a posleme na ne tento skript s parametrem jeho jmena find ${SRC} -type f -iname "*.jpg" -exec $0 {} \; fi