auto rotate photos and save them afterwards (perhaps using preview?)

Discussion in 'Mac Apps and Mac App Store' started by mrjayviper, Jan 2, 2016.

Tags:
  1. mrjayviper macrumors regular

    Joined:
    Jul 17, 2012
    #1
    So I was previewing some photos using Preview app and I notice that Preview (at least on Yosemite .5) automatically fixes rotation issues on the thumbnail on the left.

    e.g. photo is upside-down when viewing it but the thumbnail shows it the right-side up. On preview, I still have to go through each photo and manually rotate them to make the changes permanent.

    Do you know of any freebie app (or not so expensive) or perhaps using Preview? I want the app to ignore pics that's right-side up.

    Thank you
     
  2. mrjayviper thread starter macrumors regular

    Joined:
    Jul 17, 2012
    #2
    I came across a binary called "nconvert". I copied these to /usr/local/bin. I then created a simple recursive shell script to go through the folder and subfolders and convert any photo that needs converting.

    Code:
    #!/bin/sh
    
    function recursion {
    if [ $(find . \( -iname "*jpeg" -or -iname "*jpg" \) -maxdepth 1 -type f | wc -l) -gt 0 ]; then
    _fullpath=`pwd`
    echo "Processing $_fullpath"
    echo "Processing $_fullpath" > $HOME/logs/recursive-autorotate-photos.log
    nconvert -jpegtrans exif -overwrite *.jpg
    fi
    
    for _item in *; do
    if [ -d "$_item" ]; then
    (cd "$_item"; recursion)
    fi
    done
    }
    
    if [ ! -z "$1" ]; then
    if [ ! -d "$HOME/logs" ]; then
    mkdir "$HOME"/logs
    fi
    echo "" > $HOME/logs/recursive-autorotate-photos.log
    
    cd "$1"
    
    recursion
    else
    echo "Usage: recursive-autorotate-photos.sh path-here"
    fi
    
    sample: # recursive-autorotate-photos.sh "/Volumes/my-external-disk/photos"

    take note of the quotes in the path. if there's a space in the path, there you need to enclosed it in double quotes.
     

Share This Page