My application lets user take a picture with default camera on iPhone and send it to a server. Before sending it I would like to check the image size and let’s say if the size is larger than 500 KB I would let the user know filesize is too big and would not send it. Is there a way to check the image size programmatically?
Help would be appreciated.
My application lets user take a picture with default camera on iPhone and send
Share
If you convert it to
NSData, you can check thelengthproperty. The file size in MB is bytes divide by 2^20.To convert to NSData use
UIImagePNGRepresentation()