The Computer Oracle

How to automatically rotate images based on EXIF data?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Breezy Bay

--

Chapters
00:00 How To Automatically Rotate Images Based On Exif Data?
00:24 Accepted Answer Score 7
01:02 Answer 2 Score 15
01:41 Answer 3 Score 1
02:10 Answer 4 Score 0
02:36 Thank you

--

Full question
https://superuser.com/questions/670818/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#macos #jpeg #automator #rotate #exiftool

#avk47



ANSWER 1

Score 15


You may use the free jhead (which itself uses jpegtran).

To fix a picture named "image.jpg" just type :

jhead -autorot image.jpg

To fix all JPGs having EXIF data in the current folder use :

jhead -autorot *.jpg

If once rotated the thumbnail icons do not show correctly, you could refresh them by :

  1. Create a new folder (keep the untitled name)
  2. Move the affected images into the folder
  3. Using Column View, move the images back into the original folder
  4. Delete the empty untitled folder



ACCEPTED ANSWER

Score 7


You can use nconvert, which is freeware (for private and educational use) and available for Win, Linux and Mac.

This tool can rotate JPEG images lossless according to the EXIF orientation tag:

nconvert -jpegtrans exif -o 'rotated_%.jpg' *.jpg

That command will batch convert all JPEG files in the current directory and prepending their names with rotated_. This is controlled by the -o option, refer to nconvert -help for more possibilities:

-o filename       : Output filename
   Use # to specify position of numeric enumerator
   Use % to specify source filename
   Use $ to specify full source pathname
   Use $$ to specify source folder name



ANSWER 3

Score 1


This is not a scripted solution. I like this way as it allows me to change another aspects of the photos in one step.

Possible simple solution is to use Google Picasa.

After adding pictures in, all photos are autorotated for displaying. If the picture should be autorotated in the file, it is enough to push the save button on the picture folder. This will save all pictures in the folder with corrected rotation. Picasa is available for OS X as well and runs in Linux under Wine.




ANSWER 4

Score 0


If you would like to use Automator for this you can simply use Rotate Images (180deg) twice in the workflow.

For example I use an automator action that converts all images to JPEG, rotates them 360deg (due to the OP's issue) and then scales them to 1024px wide. Run the action, select the files, profit! :)