I want to losslessly rotate all JPEGs that have been shot in portrait mode and remove the rotate flag, so iPhoto doesn't stops rotating them. Any easy way to do that?

2 Answers 2


Found it:

jhead -autorot <filename> does it. To rotate all the files in a directory, just do jhead -autorot *.

You must have both jhead and jpegtran installed. jhead can be found here (OSX binary available). jpegtran can be found here (download the source and compile it using ./configure && sudo make all install).

  • To clarify, running jhead -autorot * will rotate only the files in portrait mode (which is usually what is needed).
    – laurent
    May 7, 2014 at 1:01

You can also use exiftran installed though homebrew, which by default will rotate the image and then remove the exif rotation data (set it to 1).

brew install exiftran
exiftran -ai *.jpg

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.