Iam getting an image Object from WebService and I don't know what is the format of image. Than how to change this image object into NSData. Please help. Thanks
Asked
Active
Viewed 364 times
-2
-
You can't do anything if you don't know in what format you are getting your image from webservice.. – Salman Zaidi Apr 08 '15 at 13:41
-
You can see refer to http://stackoverflow.com/questions/6476929/convert-uiimage-to-nsdata It may help you. – iPeter Apr 08 '15 at 13:45
2 Answers
1
NSData *imgData = UIImageJPEGRepresentation(yourImage, 1.0);
or
NSData* data = UIImagePNGRepresentation(yourimage);

Rahul Mayani
- 3,761
- 4
- 25
- 40
0
Only simple one line will do it for you
NSData *imageData = UIImagePNGRepresentation(yourImageView.image);

iAnurag
- 9,286
- 3
- 31
- 48