5

In my app, I put PNG images into drawable directory and use them as activity backgrounds. Since the background image usually cover the whole screen, they are big and use a lot of memory. My background images are total opaque. Is there any way that I can optimize those background images, so they can take less memory? I heard that we can reduce the color-depth of the images so they take less memory when loaded, but I don't know how to reduce the color-depth? What tool can I use?

Thanks.

Kai
  • 3,775
  • 10
  • 39
  • 54

2 Answers2

1

You can try converting your drawable to a bitmap

and then using BitmapFactory.Options to reduce the sample size, etc.

Community
  • 1
  • 1
LuxuryMode
  • 33,401
  • 34
  • 117
  • 188
0

I find the use of Universal Image Loader Library to be one of the best in providing various configurations for Image handling. And in those Configurations, we find the option to load the image in RGB_565 encoding which is capable of reducing memory consumption by upto 50% (have seen the results practically) and that is capable of making a huge impact on the memory consumption of your app.

Use .bitmapConfig(Bitmap.Config.RGB_565) in display options. Bitmaps in RGB_565 consume 2 times less memory than in ARGB_8888.

Kaushik NP
  • 6,733
  • 9
  • 31
  • 60