Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum supported image size

Since i've got a lot of these (Out of memory exception)'s when adding images, I wanted to know what's the max size can a Bitmap object support, and how to manage them efficiently.

like image 819
Mehdi Avatar asked Apr 19 '13 16:04

Mehdi


1 Answers

The maximum size of a Bitmap will vary from device to device, depending on the heap space available. The heap space required as a minimum on any device with Google Play is 16 MB.

Keep in mind that the rest of your app also runs in the same heap space, so the entire heap is not available for a single Bitmap.

Additionally, the size of the bitmap will vary depending on the color format and height and width.

The best policy is to load only the size of the bitmap required for that screen size into memory, and nothing bigger.

See this part of the documentation for details on how to handle large Bitmaps.

like image 72
Raghav Sood Avatar answered Nov 04 '22 20:11

Raghav Sood