I want to reduce image file size that take from UIImagePickerController
. I use this method
NSData *imageData = UIImageJPEGRepresentation(image, 0.1);
but it reduce 2.2 MB image file size to 300 KB I want my image file size become less than 100 KB.
Apple's docs state:
The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality).
And since the compression quality is a CGFloat, it supports decimal places beyond the tenths place. That being said, try:
NSData *imageData = UIImageJPEGRepresentation(image, 0.032);