Image Rotation that works

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

2

1 Answer

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!

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like