tags:

views:

341

answers:

2

can anyone tell me how to convert an image(PNG) to data in iphone

+3  A: 
NSData* pictureData = UIImagePNGRepresentation(image);

here image is an UIImage object

Nithin
A: 

If you want to getdata from image from bundle then its similar just you specify the path for it. Below is the code to get data from your PNG image by this way.

NSString *path = [[NSBundle mainBundle] pathForResource:@"image" ofType:@"png"];
NSData *myData = [NSData dataWithContentsOfFile:path];
Jay Vachhani