Image orientation turns 90deg CCW after upload #435

Open
opened 2018-05-05 01:17:05 +02:00 by LeRatton · 7 comments
LeRatton commented 2018-05-05 01:17:05 +02:00 (Migrated from github.com)

When uploading pictures to Spee.ch, some pictures end up 90 degrees CCW.

This is true for both Phone Snapshots and Camera Snapshots.
This is true when uploading to See.ch from Safari on a Mac or iOS.
Tested with iPhone 7 and FujiFilm XT1.


On my iphone. Took a picture of my Mac vertical (or portrait).
I Then went to spee.ch on my phone to upload the picture. The picture is oriented correctly.
I air dropped the picture to my mac
I then went to Spee.ch on my mac to upload.
The picture is turned sideways.


screen shot 2018-05-04 at 4 13 58 pm screen shot 2018-05-04 at 4 13 49 pm screen shot 2018-04-26 at 11 47 42 pm
When uploading pictures to Spee.ch, some pictures end up 90 degrees CCW. This is true for both Phone Snapshots and Camera Snapshots. This is true when uploading to See.ch from Safari on a Mac or iOS. Tested with iPhone 7 and FujiFilm XT1. ***** On my iphone. Took a picture of my Mac vertical (or portrait). I Then went to spee.ch on my phone to upload the picture. The picture is oriented correctly. I air dropped the picture to my mac I then went to Spee.ch on my mac to upload. The picture is turned sideways. ****** <img width="763" alt="screen shot 2018-05-04 at 4 13 58 pm" src="https://user-images.githubusercontent.com/29220975/39656630-2ef45272-4fb6-11e8-8180-0f6f5d323b86.png"> <img width="284" alt="screen shot 2018-05-04 at 4 13 49 pm" src="https://user-images.githubusercontent.com/29220975/39656633-2f51aaee-4fb6-11e8-959f-c008157ebb0a.png"> <img width="674" alt="screen shot 2018-04-26 at 11 47 42 pm" src="https://user-images.githubusercontent.com/29220975/39656634-2f67e002-4fb6-11e8-91e8-11c469e7ad84.png">
QuirkyRobots commented 2018-05-05 11:29:03 +02:00 (Migrated from github.com)

This seems to be an EXIF orientation error.

I duplicated the image and stripped out all the EXIF/metadata. When I did this, the one with no EXIF/metadata displayed correctly; however, the original didn't (see image).

The original image does display correctly at document level, where Chrome natively handles image orientation. Other media sharing platforms such as Twitter also displays the original image correctly.

What I take from this is, Chrome and other platforms read the width and height attributes to display the image correctly, but Spee.ch might be looking at EXIF/metadata to orientate an image and gets it wrong or It could be that the image EXIF/metadata was wrong due to camera error.

However, I could not find anything in the code to suggest this.

image

This seems to be an **EXIF** orientation error. I duplicated the image and stripped out all the EXIF/metadata. When I did this, the one with **no** EXIF/metadata displayed correctly; however, the original didn't (see image). The original image does display correctly at document level, where Chrome natively handles image orientation. Other media sharing platforms such as Twitter also displays the original image correctly. What I take from this is, Chrome and other platforms read the width and height attributes to display the image correctly, but Spee.ch might be looking at EXIF/metadata to orientate an image and gets it wrong or It could be that the image EXIF/metadata was wrong due to camera error. However, I could not find anything in the code to suggest this. ![image](https://user-images.githubusercontent.com/29914179/39661819-c5c10408-509b-11e8-81ed-97e41976c2ab.png)
QuirkyRobots commented 2018-05-05 11:45:56 +02:00 (Migrated from github.com)

*Note Adobe Dreamweaver imports the original image incorrectly also, this points towards it being a camera EXIF/metadata error.

Below is the HTML created when both versions are imported to Adobe Dreamweaver automatically.

<img src="img/speech.jpeg" width="4896" height="3264" alt=""/>
<img src="img/speech-nom.jpg" width="3264" height="4896" alt=""/>

Key: nom = No metadata.

*Note **Adobe Dreamweaver** imports the original image incorrectly also, this points towards it being a camera EXIF/metadata error. Below is the HTML created when both versions are imported to Adobe Dreamweaver automatically. `<img src="img/speech.jpeg" width="4896" height="3264" alt=""/>` `<img src="img/speech-nom.jpg" width="3264" height="4896" alt=""/>` Key: nom = No metadata.
QuirkyRobots commented 2018-05-05 13:43:27 +02:00 (Migrated from github.com)

My image of a mysterious cloud formation is also the wrong orientation.

https://spee.ch/2/20170509154009.jpeg

My image of a mysterious cloud formation is also the wrong orientation. https://spee.ch/2/20170509154009.jpeg
LeRatton commented 2018-05-05 23:42:14 +02:00 (Migrated from github.com)

I am checking the EXIF data on some of my files:

The ones that are not oriented correctly, all show the height as the width (as you mentioned above). But they also show the following:

EXIF DATA
Orientation: Rotate 90 CW

On the other hand, the pictures that show correctly have:

Orientation: Horizontal (normal)

This leads me to believe that perhaps the cameras are not smart enough to adjust width/height based on orientation but just rather add information to the orientation tag and keep everything with Width as the longest side.

The picture of the sea and boulder shows correctly everywhere else I tried: Twitter, Flickr, Google Photos.

So I believe there is added code that needs to be injected to fix this on Speed.ch

I found this that may help:

https://github.com/blueimp/JavaScript-Load-Image

I am checking the EXIF data on some of my files: The ones that are not oriented correctly, all show the height as the width (as you mentioned above). But they also show the following: EXIF DATA Orientation: Rotate 90 CW On the other hand, the pictures that show correctly have: Orientation: Horizontal (normal) This leads me to believe that perhaps the cameras are not smart enough to adjust width/height based on orientation but just rather add information to the orientation tag and keep everything with Width as the longest side. The picture of the sea and boulder shows correctly everywhere else I tried: Twitter, Flickr, Google Photos. So I believe there is added code that needs to be injected to fix this on Speed.ch I found this that may help: https://github.com/blueimp/JavaScript-Load-Image
jessopb commented 2019-01-10 03:54:04 +01:00 (Migrated from github.com)

#451 also requires EXIF filtering

#451 also requires EXIF filtering
jessopb commented 2019-01-15 19:56:47 +01:00 (Migrated from github.com)

#540 is a duplicate of this.

#540 is a duplicate of this.
kauffj commented 2019-01-16 00:54:55 +01:00 (Migrated from github.com)

@jessopb @skhameneh @tzarebczan @alyssaoc if there is fully generalizable processing behavior, it is a candidate to be added to the SDK rather than done in the app.

@jessopb @skhameneh @tzarebczan @alyssaoc if there is fully generalizable processing behavior, it is a candidate to be added to the SDK rather than done in the app.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/spee.ch#435
No description provided.