Pictures rotated randomly

Sometimes when I import a picture into Writer, the picture is rotated 90 degrees from the way it appears in Gimp, Image Viewer, or any other software. If I right click on the picture, and choose “edit Picture” it appears correctly. If I then rotate it 90, it appears flipped 180 in Libreoffice. If I then right click again, and rotate it 90 again it appears correctly, assuming I guessed right on which way to rotate it. I am writing a massive report with two pictures per page and this is getting old.

How can I convince Libreoffice to display pictures correctly rotated without this kludgey workaraound?

Using Libreoffice 3.5.7.2 on Ubuntu 12.04 LTS

Just a heads up: it has to do with image rotation flag in JPEG EXIM data.

You will likely need to upgrade to v4.1 in order to obtain support for effective rotating of images in Writer. I am not certain this change improves the ability to correctly interpret Exif data, but it would seem likely that may help.