1

I'm not sure why this is so difficult under Ubuntu/Linux. With Windows if I rotate an image in Windows Explorer or Window's image viewer, it retains that orientation everywhere in every application. But with Ubuntu some applications rotate and save that rotation, but the rotation is ignored by other applications and visa versa.

My main problem is that I can't seem to get the orientation of my photos to be set correctly and the honored by all applications. Apparently I hold my phone in different orientations when taking pictures and I'd like to fix them once and for all. But there doesn't seem to be any simple tutorial on how to do this, just random posts about command line picture editing which doesn't work if I have to open the images up in a viewer, then close and run a command on them and open them up again to check... This is madness.

The best I can find is cryptic discussions of Exif data, without any clear novice instruction.

Does someone have a simple tutorial on how to do this simply and permanently so that I can get my 1000's of pictures corrected once and for all?

Thank you

  • Do any of these suggestions work? https://help.ubuntu.com/community/Photos/RotatingPhotos – Arronical Aug 30 '18 at 16:10
  • I haven't tried all of these, but the Image Viewer definitely does not work and Shotwell doesn't work either. They just seem to rotate the Exif, but applications that don't honor Exif still display the picture in the wrong orientation. I suspect Windows literally rotates the data so that it's always correct.

    I will try some of these others though. Thank you.

    – Dave Lamb Sep 19 '18 at 11:15

1 Answers1

1

I ran into the same problem and scripted something:

It actually rotates all the data of image files in the current folder using imagemagick convert, and then resets the exif information using exiftool. You may need to add more cases, these here were sufficient for me.

#!/usr/bin/env bash

for filename in ./*; do
        rotation=$(exiftool -Orientation -n $filename)
        rotationnumber=${rotation: -1}

        if [ "$rotationnumber" == "1" ]; then
                echo "not rotated " $filename
        elif [ "$rotationnumber" == "6" ]; then
                echo "rotated 90 CW " $filename
                # rotate data 
                convert $filename -rotate 90 $filename
                # set exif orientation to not rotated
                exiftool -Orientation=1 -n $filename
        else
                echo "unknown " $filename $(exiftool -Orientation $filename)
        fi
done
rm *_original

beware, it does delete the original data!