tags:

views:

198

answers:

3

I converted an image to data in iphone using

NSData *imageData = UIImagePNGRepresentation(your_image_here);

After that i transferred it to another iphone using bluetooth. Now i need to convert the data back to image. Can any one tell me how to do it.

+3  A: 

Just call imageWithData: or on instantiation, you can call initWithData:

Jacob Relkin
+1  A: 
[UIImage imageWithData:(NSData *)data];
Ian Henry
+3  A: 

I assume this is to et back the data which you encoded in the previous question. For converting uiimage to nsdata,

NSData* pictureData = UIImagePNGRepresentation(image);

To get it back,

UIImage *image = [[UIImage alloc]initWithData:pictureData];

Remember to add [image release] at the end.

or you can use

UIImage *image = [[UIImage alloc]init;
[image imageWithData:pictureData];
Nithin
As far as you are not changing the name of the data, you can do it in the same way. But you have to get access to that data, from where it is being stored..
Nithin