How to compress image or resize image for Android apps (5MB to ~250KB).

Anilrajkumar Battini
3 min readFeb 17, 2020
Photo by JJ Ying on Unsplash

Everyone wants a great image.

No. Not everyone.

If you are a developer you can relate to that.

A client and cloud always want to store images with as much less memory as possible, as long as it doesn’t compromise the visibility of the text/details on it.

So, these days any mobile phone can take an image with decent quality sizes up to 5MB(Not Mb). And it has become a nightmare to many developers to upload/store/download an image. In an app, whenever we need an image, either we have to take it through camera or choose one from image picker. Either way we are in soup. Cause,

5MB = 5,242,880 bytes

Now you get the idea, right. Our application has to upload that 7digit figure of bytes. And you all know how cloud behaves.

Simply ERRATIC, especially during uploading of images/documents.

Instead of complaining on internet speed and cloud limitations of uploading and downloading, let us address the root cause of the problem.

SIZE.

Everyone knows this is the problem. Then what’s fuss?

yourBitmap.compress(Bitmap.CompressFormat.JPEG, 40, fout)

--

--