codenameone

How can EncodedImage Successfully Compress Image in iOS


When trying to compress images size using EncodedImage class e.g.

EncodedImage encodedImage = EncodedImage.createFromImage(image, true);

, image by Capture (camera or gallery) is compressed e.g. from size 2+MB to less than 300KB in Simulator & Android phone.

But in iPhone (iOS device) the size remains the same.

How can EncodedImage class also compress image in iOS?


Solution

  • This is probably due to the usage of similar quality levels in the image. I suggest using the ImageIO API directly and setting the quality parameter to a lower setting in order to tune the image size.