Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bitmap to large error is complaining about twice the image size

I'm receiving the infamous OpenGLRenderer error that "Bitmap too large to be uploaded into a texture." I'm familiar with the error and know that I need to keep my images below 2048 pixels to avoid it.

However, on one particular phone, the Samsung Galaxy Nexus, it is reporting image sizes that are twice the actual image size.

My image is in the drawable folder and has a size of 2048x95. When I run the app and attempt to add that image to the display, I get the infamous error:

Bitmap too large to be uploaded into a texture (4096x190, max=2048x2048)

What gives?

like image 375
harwalan Avatar asked Feb 19 '13 21:02

harwalan


1 Answers

If your image is in the drawable folder then it will be scaled to the appropriate density depending on the device. This means for mdpi devices, your image will be the appropriate dimensions but for hdpi, xhdpi, and xxhdpi that your image will be much larger than you think and ldpi devices the image will be smaller.

If you don't want the image to scale like that on the Galaxy Nexus then place it in the drawable-xhdpi folder.

like image 63
Michael Celey Avatar answered Sep 29 '22 06:09

Michael Celey