Is there a faster way to convert a UIImage into NSData than NSData* imageData = UIImagePNGRepresentation (image1 );
Asked
Active
Viewed 120 times
0
-
1It will depend on the usage scenario and the source of image. Please provide more details. – proxi Apr 19 '14 at 20:33
-
See http://stackoverflow.com/questions/6476929/convert-uiimage-to-nsdata?rq=1 – rmaddy Apr 19 '14 at 20:49
2 Answers
1
This is a common problem when using UIImagePickerController. That specific conversion is the bottleneck of any app trying to use that method. Using UIImageJPEGRepresentation(Image, 0.1), (the 0.1 is the level of compression, this can be any value from 1.0 to 0.1 given the level of quality you wish to keep) is the best thing you can use because is much much faster. Hope it helps!
Please note this is a generalised answer, if you could elaborate more on what are you doing I might be able to provide helpful code.

Gabriel
- 561
- 5
- 9
0
Try executing this on a background thread, so although it will take the same time, it may not appear so to the user

anotherDeveloper
- 77
- 1
- 1
- 8