Why Bitmap Size Is Bigger In Memory Than On Disk In Android?
I have a 2448x3264 image on my SD card that consumes 1,667,072 bytes but when I load it as a Bitmap and calculate its size using getRowBytes()*getHeight() I end up with 15,980,544
Solution 1:
That is because the image is compressed when it is on disk (stored in a JPG, PNG, or similar format). Once you load the image into memory, it is no longer compressed and takes up as much memory as is necessary for all the pixels (typically width * height * 4 for RGBA_8888, or width * height * 2 for RGB_565).
Post a Comment for "Why Bitmap Size Is Bigger In Memory Than On Disk In Android?"