1

Certain part of images captured by my Motorola Moto phone (problem occurs in many models, i.e. Moto One, Moto Z2 Play etc.) are rotated clockwise 90 degrees. I am unable to rotate them using IrfanView even though I used it to rotate dozens of thousands of images for past 15 years.

I rotate images as usual, i.e.

  • open them in IrfanView,
  • (image is rotated clockwise 90 degrees in the viewport),
  • press l once (rotate left),
  • (image is correctly rotated in the viewport),
  • press Ctrl+s to save,
  • pick a new name (to avoid possible access rights problems),
  • open newly saved file again in IrfanView,
  • (image is again rotated clockwise 90 degrees in the viewport).

I can repeat above steps over and over again or I can pick the same filename and overwrite the original file. All for nothing -- image remains incorrectly rotated in the file and is rotated correctly only in the viewport.

To make things even more weird, I have made following observations:

  • image is always rotated in IrfanView (when read from file),
  • image is always rotated in Total Commander's Viewer (pressing F3 on file),
  • image is always displayed correctly in Microsoft Paint,
  • image is rotated when attached to an e-mail message (recipient confirms, it is rotated),
  • image is rotated when dropped into new tab of Chrome, Firefox and Opera browsers,
  • image is always displayed correctly when dropped into new tab of Internet Explorer.

I am unable to check Microsoft Edge, but it pretty much seems that image is always shown correctly in any Microsoft-related software and always rotated in any 3rd party software.

enter image description here

(Rotated or not? Here is an example of the very same image, read from the very same file on disk, displayed rotated in Chrome and IrfanView and correctly in Microsoft Paint and Internet Explorer)

Are there any two different .jpg reading libraries / algorithms, one used by Microsoft and the other one (or ones) used in 3rd party software, of which one can cause image to be displayed rotated?

11
  • I'm using Irfanview 4.42 64-bit with PNGs and cannot replicate this issue. All files remain as they are after rotation. What format are the images? are they SFW - could you upload one perhaps?
    – Smock
    Aug 7, 2019 at 14:05
  • This is most likely because the source of this problem is... the source, i.e. the way how Motorola-like phones are saving these .jpgs.
    – trejder
    Aug 7, 2019 at 14:10
  • 2
    Is this problem presenting because the JPEG contains EXIF data that describes the camera's rotation at the time of capture?... Try opening the image, select all, copy, new image, paste, rotate, save... or remove EXIF data by other means if you're able. Not all applications (e.g: Paint) will obey EXIF the data.
    – Attie
    Aug 7, 2019 at 14:29
  • 1
    @wrecclesham: Certainly via some file-sharing website.
    – harrymc
    Aug 7, 2019 at 15:55
  • 1
    @trejder of course a screenshot showing MS Paint is a screenshot. No one is suggesting it's not. When I said: "if the OP posts the image here" that referred to the ORIGINAL file, direct from your camera. The rotation metadata only exists in the original file. That's why I am only interested in the original file. Aug 8, 2019 at 21:36

2 Answers 2

3

Most cameras will add EXIF data to images, which can include a lot of information about the image - camera model, exposure settings, zoom, date, time, location and importantly for your question the orientation of the camera.

This orientation information is used by some image viewers and editing software to present the photograph with the correct rotation, but by no means all...

  • Some image editing software will re-write just the EXIF data to account for any rotation that you request, without actually altering the image... typically more photo-oriented software. This rotation will likely only be presented correctly in software that obeys the EXIF data
  • Other image editing software will actually reset the EXIF data and manipulate the image data directly - this rotation should be visible in all viewers.
  • MS Paint will observe the orientation data - but after rotating and saving will leave the EXIF orientation data as-is, while manipulating the image data... which I think is a bit broken.
  • Very basic image editing software will strip the EXIF data and save just the image data - this can be simulated by Select All → Copy → New → Paste.
  • From your question, I'd suggest that IrfanView is only temporarily rotating the image for presentation - i.e: it doesn't alter the EXIF data, and it doesn't alter the image data either.

If you're having issues with rotation and need to be sure, then I'd suggest that you open the image in an editor, select the whole canvas, and copy and paste it into a new image. Once you have the new image (not a "photo" per se, no EXIF data), perform any required rotation and save it.


In some situations it's possible for the orientation to be recorded incorrectly - for example when taking a photo almost straight downwards or upwards the camera can pick the wrong orientation - think of the bubble in a spirit level... with a horizontal lens the orientation is obvious, with a vertical lens the orientation is not.

circular spirit level

2
  • A perfect and very detailed answer, thank you. The only pity thing is that the most obvious solution to described problem is to strip off EXIF data, loosing all the valuable information stored there (no way to keep the rest only correcting wrong rotation, without some tailored EXIF data editor).
    – trejder
    Aug 17, 2019 at 7:30
  • No problem! It's certainly the "sure" method, but if you know your tools (what they do, configuration, etc...), then there may well be an alternative (e.g: reset orientation while rotating the image)... Additionally, if the tool is "misbehaving", then it may be sensible to drop it in favour of another?
    – Attie
    Aug 17, 2019 at 10:52
2

As per this forum post, by jazzman, in the IrfanView support forum, IrfanView itself has an appropriate option for dealing with rotation information stored in EXIF records.

Corresponding option is called "Reset EXIF orientation tag" and is available within other save-related options in "Save as" dialog, when saving (rotated) image in JPEG format:

enter image description here

Note: Since this Super User answer is just a copy of corresponding forum post (not my own invention) and because Attie provided much more comprehensive answer before me, I keep that answer as accepted one.

1
  • I'm glad you found the "correct" method for the software you're using, and thanks for posting the info!
    – Attie
    Dec 5, 2019 at 13:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .