2

We have an UIImage of size 1280*854 and we are trying to save it in png format.

NSData *pngData = UIImagePNGRepresentation(img);

The problem is that the size of pngData is 9551944 which is inappropriately large for the input image size. Even considering 24 bit PNG, at the max it should be 1280*854*3 (3 for 24 bit png).

BTW, this is only happening with images scaled with UIGraphicsGetImageFromCurrentImageContext. We also noticed that image._scale is set to 2.0 in image returned by UIGraphicsGetImageFromCurrentImageContext.

Any idea what's wrong.

MilanPanchal
  • 2,943
  • 1
  • 19
  • 37
mesibo
  • 3,970
  • 6
  • 25
  • 43

0 Answers0