iphoneiosuiimagepickercontrolleruidevice

Iphone get photo resolution programmatically


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:

check model version->write a dictionary with dimensions of each iphone model -> take the correct index


Solution

  • When you take a picture, you get an UIImage.

    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.

    Source

    ProTip: Read the documentation.