question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inspect EXIF data for rotation - Image orientation/rotation is wrong for some images

See original GitHub issue

I tried compressing a photo taken with my Samsung Galaxy S8 (in portrait orientation) but the image shows up in wrong orientation (rotated 90 degrees) in https://squoosh.app/ and there also didn’t seem to be any option to rotate the image.

The photo shows in correct orientation if I view it e.g. in image preview of macOS Finder. If I save the compressed image from squoosh then it will show up in wrong orientation also in other apps.

I suspect the issue is that squoosh doesn’t take into account the EXIF Orientation information in the photo.

Here’s the photo I had the issue with: test

(Ps. looks like the image also appears in wrong orientation in this GitHub issue using Chrome at least, but if I click on it so that it opens in a new tab then it is shown in the correct orientation. It should be shown so that the text is oriented horizontally [easily readable].)

If I check the EXIF data of the image (with e.g. exiftool) I can see it has the correct orientation info:

$ exiftool test.jpg | grep Orientation
Orientation                     : Rotate 90 CW

Or checking with identify (from ImageMagick):

$ identify -verbose test.jpg | grep Orientation
  Orientation: RightTop
    exif:Orientation: 6
    exif:thumbnail:Orientation: 6

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:3
  • Comments:36 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
Haprogcommented, Nov 19, 2018

Btw I just tested my image (the one above) by loading it into https://squoosh.app/ in these browsers.

Tested on macOS Mojave 10.14.1

  • Chome 70.0.3538.102 (64-bit)
  • Chrome Canary 72.0.3614.0 (64-bit)
  • Firefox 63.0.3 (64-bit)
  • Firefox Beta 64.0b10 (64-bit)
  • Firefox Nightly 65.0a1 (2018-11-18) (64-bit)
  • Safari 12.0.1 (14606.2.104.1.1)
  • Safari Technology Preview Release 70 (Safari 12.1, WebKit 14607.1.13)
  • Opera 56.0.3051.104

Tested on Android 8.0.0 (Samsung Galaxy S8):

  • Android Chome 70.0.3538.80
  • Android Firefox 63.0.2

All of these browsers consistently show the image in wrong orientation (all the same way) when loaded into Squoosh. I also tested loading this GitHub issue in all of these browsers and it was exactly the same. All browsers tested show the image in the same way. In the <img> tag in an HTML document the image is always shown wrongly oriented. And in all of the browsers when opening the image directly in a new tab, only then the image is shown in correct orientation.

4reactions
jakearchibaldcommented, Nov 17, 2018

I’m working on a rotate option right now. The second phase of this would be to read exif data to set the rotation automatically. Thanks for filling this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to detect if Image has only wrong EXIF or Image should ...
There's no (easy) way to detect an image orientation other than read its EXIF data and check for the Orientation value.
Read more >
JPEG Image Orientation and Exif - jdhao's digital space
When I show these photos on my Windows 10 machine, since Windows 10 respects the orientation flag, some of the images will be...
Read more >
image rotation is on wrong direction - General Support
Then the person who uploads the photo can check the orientation. My understanding is that PW doesn't remove EXIF data from uploaded image,...
Read more >
Rotate Photos to be Upright - Sirv Help Center
Save time with auto-rotate and use Sirv to fix incorrect EXIF orientation ... EXIF data is useful information about a JPEG image, hidden...
Read more >
Crazy Image EXIF Orientation Bug (or Feature?)
The issue was all his uploaded images were looking rotated. That was something fishy. I thought he might have messed up with some...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found