最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - EXIF Orientation Issue in Safari Mobile - Stack Overflow

programmeradmin2浏览0评论

I have an angular 2 application in production environment that allows you to choose a profile picture. Recently, performing tests with safari mobile, specifically for IOS 13.3.1 version(older) and IOS 13.4.1(new) version. I noticed that the image is shown rotated depending of safari browser version used (I built a stackblitz for this that you can review):

IOS 13.3.1 version(older)

IOS 13.4.1(new)

When I take images from an iPhone's in portrait mode and upload the image to my app it is shown rotated only for IOS 13.3.1 version(older). However, I examined the EXIF ​​meta-information images from each of my devices and found that both images have the same value in the orientation property:

IOS 13.3.1 version(older)

IOS 13.4.1(new)

My question is. Why does the image display change depending on the IOS version, knowing that in both cases the orientation EXIF is the same value (6)?

This is a subject that worries me since I had already solved this problem by rotating the image depending of EXIF orientation value for its correct display (e.g. exif.js have been created to handle this situation by detecting the exif orientation flag), but this problem now appears again with the new version of IOS. What would be an example of code that I can use to make it sustainable over time? Is there not a consensus among the browsers to manage the orientation of the images?

What is the explanation for this illogical behavior?

Thank you so much!

I have an angular 2 application in production environment that allows you to choose a profile picture. Recently, performing tests with safari mobile, specifically for IOS 13.3.1 version(older) and IOS 13.4.1(new) version. I noticed that the image is shown rotated depending of safari browser version used (I built a stackblitz for this that you can review):

IOS 13.3.1 version(older)

IOS 13.4.1(new)

When I take images from an iPhone's in portrait mode and upload the image to my app it is shown rotated only for IOS 13.3.1 version(older). However, I examined the EXIF ​​meta-information images from each of my devices and found that both images have the same value in the orientation property:

IOS 13.3.1 version(older)

IOS 13.4.1(new)

My question is. Why does the image display change depending on the IOS version, knowing that in both cases the orientation EXIF is the same value (6)?

This is a subject that worries me since I had already solved this problem by rotating the image depending of EXIF orientation value for its correct display (e.g. exif.js have been created to handle this situation by detecting the exif orientation flag), but this problem now appears again with the new version of IOS. What would be an example of code that I can use to make it sustainable over time? Is there not a consensus among the browsers to manage the orientation of the images?

What is the explanation for this illogical behavior?

Thank you so much!

Share Improve this question edited Apr 23, 2020 at 15:00 AlejoDev asked Apr 23, 2020 at 14:53 AlejoDevAlejoDev 3,17211 gold badges40 silver badges67 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

We also stumbled upon this when our mobile suddenly behaved differently and finally find the root cause of this.

Both WebKit (iOS) and Android (Chrome) have just recently changed the default behavior of the image-orientation CSS propterty. While it was none before, it is now from-image. This means: Before, they ignored the EXIF data of an image by default, while they are now using it to auto-correct the image. Which break our own auto-correction based on the exifreader library.

Here are some relevant links:

  • https://www.fxsitepat.dev/en-CA/docs/2020/jpeg-images-are-now-rotated-by-default-according-to-exif-data/

  • https://bugs.webkit/show_bug.cgi?id=89052

Funny enough, also the Slack team seems to have run into this:

  • https://bugzilla.mozilla/show_bug.cgi?id=1634180

Fortunately, the author of the exifreader library (who just some weeks later ran into the same problems) also guided me to a way to detect the behavior. You can find his answer here:

  • https://github./mattiasw/ExifReader/issues/99#issuement-640217716

I also noticed that Modernizr has a test for this, so I am actually using a custom modernizr build now to detect the browser behavior.

The webkit browser is rotating the images before you upload them based on the EXIF data then it gets applied again by your app. We were able to confirm this on new (81) version of Chrome and Mobile Safari on 13.4. then the app is rotating them further and it gets twisted.

发布评论

评论列表(0)

  1. 暂无评论