I didn’t try UIImageJPEGRepresentation()
before, but UIImagePNGRepresentation
works fine for me, and conversion between NSData
and UIImage
is dead simple:
NSData *imageData = UIImagePNGRepresentation(image);
UIImage *image=[UIImage imageWithData:imageData];