iPhone以编程方式获取照片分辨率 [英] Iphone get photo resolution programmatically
问题描述
有没有办法以编程方式获取用iphone拍摄的照片的尺寸?我想直接获取尺寸而不通过模型版本,因此该解决方案无效:
There's a way to get programmatically the dimensions of a photo taken with an iphone? I want to take the dimensions directly without passing throught model version,so this solution can't be valid:
检查模型版本->编写具有每个iphone型号尺寸的字典->获取正确的索引
check model version->write a dictionary with dimensions of each iphone model -> take the correct index
推荐答案
拍照时,会得到一个UIImage.
When you take a picture, you get an UIImage.
UIImage对象具有-(CGSize)size方法,该方法返回以磅为单位的图像尺寸.您应该将其乘以scale属性,以获取像素.
UIImage objects have a -(CGSize)size method that returns the dimensions of the image in points. You should multiply it by it's scale property to get pixels.
ProTip: Read the documentation.
这篇关于iPhone以编程方式获取照片分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!