Safari Mobile 中的 EXIF 方向问题 [英] EXIF Orientation Issue in Safari Mobile

查看:14
本文介绍了Safari Mobile 中的 EXIF 方向问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在生产环境中有一个 angular 2 应用程序,它允许您选择个人资料图片.最近在用safari mobile进行测试,主要针对IOS 13.3.1版本(旧)和IOS 13.4.1(新)版本.我注意到图像根据使用的 safari 浏览器版本旋转显示(

IOS 13.4.1(新)

当我以纵向模式从 iPhone 拍摄图像并将图像上传到我的应用程序时,它显示仅针对 IOS 13.3.1 版本(旧版)旋转.然而,我检查了我的每台设备的 EXIF 元信息图像,发现两个图像在方向属性中具有相同的值:

IOS 13.3.1 版本(旧)

IOS 13.4.1(新)

我的问题是.为什么图像显示会根据IOS版本而变化,知道两种情况下的方向EXIF都是相同的值(6)?

这是一个让我担心的主题,因为我已经通过根据 EXIF 方向值旋转图像以使其正确显示来解决这个问题(例如,已经创建了 exif.js 来通过检测 exif 方向标志来处理这种情况),但是现在新版本的IOS又出现了这个问题.什么是我可以用来使其随着时间的推移可持续的代码示例?浏览器之间在管理图像方向上是否没有达成共识?

这种不合逻辑的行为的解释是什么?

非常感谢!

解决方案

Webkit 浏览器会在您根据 EXIF 数据上传图像之前旋转图像,然后您的应用会再次应用这些图像.我们能够在 13.4 上的新 (81) 版 Chrome 和 Mobile Safari 上确认这一点.然后应用程序会进一步旋转它们并扭曲.

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!

解决方案

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.

这篇关于Safari Mobile 中的 EXIF 方向问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆