0

Is there a faster way to convert a UIImage into NSData than NSData* imageData = UIImagePNGRepresentation (image1 );

Michael
  • 6,451
  • 5
  • 31
  • 53
Apollo
  • 8,874
  • 32
  • 104
  • 192

2 Answers2

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