I can create UIImage from NSData using [UIImage imageWithData:] or [UIImage initWithData:] methods.
UIImage
NSData
[UIImage imageWithData:]
[UIImage initWithData:]
I wonder if I can get the NSData back from an existing UIImage? Something on the line of NSData *myData = [myImage getData];
NSData *myData = [myImage getData];
NSData *imageData = UIImageJPEGRepresentation(image, 0.7); // 0.7 is JPG quality
or
NSData *imageData = UIImagePNGRepresentation(image);
Depending if you want your data in PNG format or JPG format.
1.4m articles
1.4m replys
5 comments
57.0k users