问题描述
我们正在使用Canvas在上传到我们的服务器之前调整Iphone / IPAD上的图片。
We are using Canvas to resize images on Iphone/IPAD before uploading to our server.
在iPhone 4S和5上,当照片以横向模式相机,调整大小工作正常。在纵向模式下拍摄时,图像被压缩约1/4。但是,当使用后置摄像头拍摄时,所有的图像,包括风景和肖像,被压扁约7/8,只留下一个细腰带。
On IPhone 4S and 5, when photos are taken in landscape mode with FRONT camera, the resizing works fine. When taken in portrait mode, the images are squashed by about 1/4. But when taken with rear camera, all images, both landscape and portrait, are squashed by about 7/8, leaving just a thin belt to view.
在IPAD和IPOD ,对于前和后摄像头是相同的:风景图像是精细的,但肖像图像被挤压1/4。
On IPAD and IPOD, it is the same for front and rear camera: landscape images are fine, but portrait images are squashed by 1/4.
我们尝试了几种不同的调整大小算法,但结果是相同的结果。
We tried several different resizing algorithms, but ended up with the same results.
任何想法如何解决这个问题?
Any ideas how to solve this problem?
推荐答案
解决方案,适用于我在。该解决方案通过stomita认证,并于2014年1月14日发布并编辑(我相信)bymbre和亚光灼伤。
Found a solution that works for me at HTML5 Canvas drawImage ratio bug iOS . The solution is accredited to stomita and posted and edited (I believe) by tombre and matt burns on 14 Jan 2014.
这篇关于在上传到服务器之前,使用Canvas调整Iphone图片大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!