The UIImageJPEGRepresentation not return the original image. It will return compressed value of an actual image. Need to load original image data set in NSData. Is there any way to read actual data from image?
Asked
Active
Viewed 380 times
1
-
can you show ur tried code – Anbu.Karthik Nov 30 '16 at 09:47
-
http://stackoverflow.com/questions/17005456/calling-imagewithdatauiimagejpegrepresentation-multiple-times-only-compresses – Prashant Tukadiya Nov 30 '16 at 09:48
1 Answers
-2
I think you have tried below code to using UIImageJPEGRepresentation
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
You can convert image to data like this and vice-versa like this.
Convert UIImage to NSData (png) :
UIImage *image = [UIImage imageNamed:@"imageName.png"];
NSData *imageData = UIImagePNGRepresentation(image);
Convert NSData to UIImage :
NSData *data = ... // data that you received
UIImage *image = [UIImage imageWithData:data];

Wolverine
- 4,264
- 1
- 27
- 49