[Tex/LaTex] Latex rotating the iphone 5s .jpg pictures

graphicsrotating

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!

Best Answer

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.

Related Question