I am getting UIImage using UIImagePickerController. How can i calculate number of bytes hold by that Image in kb/mb ?
Using that values I have to make logic that user cant add Images more than size of 1MB
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sure you can. Convert the
UIImageto aNSDataobject, which has thelengthproperty, which will give you its size in bytes. Then you can easily calculate the size in whatever unit you need.So for example: