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 Responses to “Autorotate Images on Linux”

  1. clem sagt:

    Again another useulf Linux-trick, thanks!

  2. clem sagt:

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

  3. Thanks for the tip! Exactly what I was looking for.

  4. david sagt:

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

  5. Rainer sagt:

    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

  6. -z- sagt:

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

  7. s sagt:

    Thanks! I added it in the context menu of Nautilus using nautilus-actions and it works great!

  8. mbonnin sagt:

    Thanks for the info. Note Image Magick allows the same trick with:
    mogrify -auto-orient image.jpg

  9. Denis sagt:

    Dominik, thanks.

  10. Leo sagt:

    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