I want to get the image size in kb and MB from the user. Like, I have one image, and the image size is 1Mb so I want to compress this image size according to the size given by the user.
I used this code :
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, imageQuality, stream);
byte[] imageBytes = stream.toByteArray();
return android.util.Base64.encodeToString(imageBytes, Base64.DEFAULT);
But there is confusion about the image quality, It works well but here I can't measure how much quality it reduces because here we give quality in % but I want to compress the image according to kb and MB.