We have to write a single line to compress the image at a time when we are uploading our image to a server.

NSData *dataForPNGFile = UIImageJPEGRepresentation(imgPicked, 0.0f);

0.0f is the maximum & 1.0f is the minimum compress ratio we can change based on our requirements.

The image will be compressed based on their pixel size.

You may also like

Leave a Reply