Change NSData Size of a UIImage - Compress And Resize UIImage With a Maximum Megabyte Mb limit

Viewed 3410

I have a UIImage that the user has uploaded.

If the image data is more than 10Mb how can I resize it to a maximum of 10 Mb? So far the closest thing I've found for data resizing is this:

NSData *imageData = UIImageJPEGRepresentation(theUploadedImage.image, 0.5f);

But I don't seem to have control over the Mb of file size... just over the second parameter in the JPG representation (image quality float)

1 Answers
Related