Here's a short means I used to reduce the size of Images that have a high byteCount
(basically pixels)
fun resizeImage(image: Bitmap): Bitmap {
val width = image.width
val height = image.height
val scaleWidth = width / 10
val scaleHeight = height / 10
if (image.byteCount <= 1000000)
return image
return Bitmap.createScaledBitmap(image, scaleWidth, scaleHeight, false)
}
This returns a scaled Bitmap that is over 10 times smaller than the Bitmap
passed as a parameter. Might not be the most ideal solution but it works.