Home > Blog >


Contact Us



Have a mobile app idea or want to benefit from our web solutions ?


info@techaheadcorp.com

Let’s talk about ImagePicker of iPhone application development.

I must say that if you are trying to create some image editing software for iPhone, you will think CGContext as one of the choices.I must add here that CGContext is very easy to use if you know what you want to do but at the same time it can get very expensive on memory when we are dealing with huge images. Generally images taken by iPhone are pretty huge in size. They are more than 6 MBs in raw form !

Here is a code which takes picture:

In case 0,if user has choosen camera as an option to take picture then it checks if there is camera available then it takes the picture.

In case 1, if user has choosen photo library to pick up the pictures, then it takes user to photo library of iPhone where user can pick up the picture of his choice.

As we have used imagePicker multiple times , before initializing it everytime we release it and make it nil so that we dont allocate memory again and again.

Now once user has choosen the image from photoalbum or clicked a new picture, following delegate method gets called :

UIImage * image comes with very high MB . We tracked it on Instrument , when you take a fresh picture or select a photo , your memory allocation increases upto as high as 6 MB. And if you doing retake again and again , it might end up crashing your application.Hence we need to decrease that allocation. So we have used resizing of the image. As soon as it gets in resize it.This tremendously decreases the load on iPhone !

Hope this post helps to developers dealing with image picker.

Stay Connected


          
Subscribe via Email


 

Subscribe