Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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.
- #
- # jc for http://piwigo.org/forum/viewtopic.php?id=19787
- SRC='/home/user/fotos' # must exist
- DST='/home/user/fotos-rotated' # must exist
- if [ $# -gt 0 ]; then
- # 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
- # or test in rotated/ directory: find . -type f -iname "*.jpg" -exec exif -t Orientation --remove -o "{}" "{}" \;
- # else
- # echo "OK: $* ($EXIF)"
- fi
- fi
- # exiftool binary (pretty slow)
- #EXIF=''
- #EXIF=`exiftool -Orientation --struct "$*"|grep Rotate`
- #if [ "${EXIF}" != "" ]; then
- # echo "ROTATED: $*"
- #fi
- else
- find ${SRC} -type f -iname "*.jpg" -exec $0 {} \;
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement