I have a PNG image of 168.2KB and 1991x1756 and tried to import it into a Bitmap
using BitmapFactory.decodeStream()
. The problem is that I run into OutOfMemoryError
where the Bitmap
size ends up being 13,657KB.
What I don't understand is why is the file so big after the import and how to mitigate this.
Seems that this OutOfMemoryError
issue is very common with decoded Bitmap
images but can't find a way to fix it. Any ideas?
Bitmap bitmap = BitmapFactory.decodeStream(inputStream, null, bitmapOptions);
E/AndroidRuntime(10744): java.lang.OutOfMemoryError: bitmap size exceeds VM budget(Heap Size=7815KB, Allocated=3279KB, Bitmap Size=13657KB)