-2

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

2 Answers2

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