GoogleChromeLabs / GoogleChromeLabs/squoosh

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

Open
#299 36 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request help wanted UI
Dominant language
TypeScript
Stars
25.9k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

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](http://sylvana.net/jpegcrop/exif_orientation.html) information in the photo.

Here's the photo I had the issue with:
![test](https://user-images.githubusercontent.com/75155/48555052-c03bc780-e8e8-11e8-861a-c0ef6c541421.jpg)

(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](https://sno.phy.queensu.ca/~phil/exiftool/)) I can see it has the correct orientation info:
```sh
$ exiftool test.jpg | grep Orientation
Orientation : Rotate 90 CW
```

Or checking with [identify](https://linux.die.net/man/1/identify) (from ImageMagick):
```sh
$ identify -verbose test.jpg | grep Orientation
Orientation: RightTop
exif:Orientation: 6
exif:thumbnail:Orientation: 6
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in squoosh.app with the supplied Samsung Galaxy S8 image and inspect how its EXIF Orientation value is handled during compression. Done means the compressed image displays with the text horizontally oriented in other image viewers, not only in the original preview.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.