Autorotate Images on Linux

Cameras store information about the orientation of an image in the so-called exif. Many programs automatically rotate images when displaying them. However they do not store the image after the rotation which is necessary if you want to publish your pictures in a gallery. Under linux the tool jhead does this job for you.
The command jhead -autorot *.jpg will rotate all files ending with .jpg in the current folder if necessary (i.e. if the exif-data indicate that you should rotate the image).

10 thoughts on “Autorotate Images on Linux

  1. By the way, yesterday I used «your» qiv delete picture procedure to sort out the images in a folder: really nice! 🙂

  2. david

    lustig, das internet. da such ich nach exif autorotate und lande auf deiner webseite. genau das hab ich gesucht…
    gruss aus bern, david

  3. Rainer

    Greeeez,

    and thanks for that tip. Exactly what I was looking for: losless mass jpeg transformation.

    Here is my command for recursive operation:
    find . -type f -iregex «.*\.jpg$» -exec jhead -autorot «{}» \;

    Regards from Austria,
    Rainer

  4. -z-

    thanks the suggestion, anyway I suggest to use the «-ft» for set image timestamp to the exif date/time. regards from hungary… 🙂

  5. Believe that should be:

    find . -type f -iregex ‹.*\.jpg$› -exec jhead -autorot ‹{}› \;

    or

    find . -type f -iregex ‹.*\.jpg$› -exec jhead -ft -autorot ‹{}› \;

    Single quotes didn’t work for me

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.