views:

36

answers:

1

To what extend do color depth and compression level of the original jpg and/or png images used as drawables have an effect on the app's UI performance, given the fact that all images are converted to bitmaps internally anyway. Especially considering i.e. images in list views for example.

Same question goes for png vs. xml shapes as drawables.

Edit: I found a similar question which addresses memory usage, but my focus is more on UI performance (i.e. scrolling long list views, etc.). http://stackoverflow.com/questions/2602282/android-is-decreasing-size-of-png-files-have-some-effect-to-resulted-bitmap-in

Larger images probably take longer for decompressing, but when they're cached properly (and i.e. asynchronous lazy loading), after initial loading, it shouldn't matter anymore.

A: 

If the images are indeed all are converted to bitmaps internally anyway, then I think you're right, the compression level of the original file makes no difference once the image is loaded.

Color depth of the image, on the other hand, would still be a preserved difference, right? I.e. image files of different color depth on disk can be loaded to in-memory images of different color depth. So I would expect "deeper" images to have an adverse effect on performance eventually.

But as always, you never know for sure about performance till you run tests.

LarsH
Where would such difference be 'preserved'? Do you mean, in memory, after it's converted to bitmap? I didn't get this part fully. If I load two images with the same width/height but i.e. one is png-8 and png-24, they will be two different bitmaps of course, as they're already different original images (altough taking same amount of memory). I guess it indeed requires some tests in practice.
Mathias Lin
@Mathias, I can't personally speak specifically in regard to Android, but the question you linked to confirms that even there, bitmaps can be stored in memory with 16-bit or 32-bit configurations ("ARGB_8888 or simply RGB_565"). They would *not* take the same amount of memory: one would take 16 bits per pixel, the other 32. Your hardware may not support all configurations. If you can load a png-24 file and coerce it to store in RGB_565 configuration, you'll lose color resolution but save memory.
LarsH
Thanks for clarification on bitmaps. But I guess regarding UI performance it has to be tested in practice, hard to make theoretical assumptions based on memory consumption I fear.
Mathias Lin