My iPhone pictures are automatically saved as .jpg files. When I want to load the Pictures to my latex document, they are somehow rotated 90 degrees. However if I edit the pictures and save them as.png files, the pictures are not rotated! If I download a random image on the internet and save it as a .jpg file, the picture is not rotated either. So why is my iPhone .jpg pictures automatically rotated? I can use the rotate function and rotate the picture 270 degrees, however the caption isn't centered anymore. Hope to hear from you!


Converting .jpg photographs to .png isn't a great idea in general.

LaTex will be showing the file as it is and I think ignores the orientation tag. When you view the file elsewhere it may be rotated (or might not) depending on how the viewer uses the tag, and it can all get very confusing.

I suggest removing the orientation tag altogether. This is best done without the loss of image quality that would result from re-saving and re-compressing the jpg. You can achieve this using the Exiftools command line utility to do this (available on several platforms)

The relevant command line will be

exiftool -Orientation= img_7755.jpg

(There is a space after the "=")

That will not de-rotate the image if it was originally rotated, but you will see it in its original orientation and can then add rotation in LaTex if that is what you desire. Be sure to keep a backup (exiftool should save the file under a new name).

You can process every file in a folder with something like

exiftool -Orientation= *.jpg

(again note the space, and it may be case sensitive depending on your OS)

You can also rotate the image losslessly if you wish (this is a hard rotation that does not depend on a tag). In windows, an easy way to do this is to use the jpg lossless rotation plugin in irfanview.

  • Thank you. How do I implement the command line? – Rune May 21 '15 at 23:32
  • Ah, that's a whole separate topic depending on your OS. In Windows you could put it in a batch file. Or you could enter the command at a command prompt. – Aubrey Blumsohn May 21 '15 at 23:38
  • hrm. I feel LaTeX should respect the orientation flag. Is this not being done on purpose or is it considered a bug? – Frederick Nord Jun 10 '16 at 9:10
  • Not at all - it would break almost everything in latex. More importantly example web browsers don't respect the tag either, and if they suddenly did, the most prolific uses of jpegs in the world would suddenly fall over. The tag is just there for information to convey how the camera was orientated when the picture was taken -- it is not really there to instruct the viewer how to display it for every particular usage. – Aubrey Blumsohn Jun 15 '16 at 9:52
  • exiftool didn't work for me on Windows, but using Paint to convert the image to a bitmap and then convert it back to a JPG worked for me. – user161335 Apr 21 '18 at 9:32

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.