Images: What size do we want?

By July 12, 2011August 8th, 2011No Comments

Android devices come in many different sizes and shapes; for the most part, if you design your apps properly they will work just fine on any device, automatically adjusting to fit the available space.

One nice feature built into Android is the ability to store multiple versions of an image in an app, so it can choose the most appropriate size for a particular device. To take advantage of this, you must provide your images at different resolutions, and organize them into folders based on the density (DPI) they were designed for.

This is a very useful and powerful feature, but it raised an interesting design problem for us: how could we make Andromo apps look good without complicating things by asking our users for multiple versions of each image?

Luckily, Android will automatically resize images as required “on the fly” so you can get by with only one size for each image. To keep things simple, we decided that whenever possible we would ask for a single image, and let the Android framework handle the image scaling. But which size should we ask for?

The Android platform uses a pixel density of roughly 160 DPI as the baseline, or “normal” density. (I think this is simply based on the density of the very first Android device.) Google calls this medium density, or MDPI. At first it seemed like it might make sense to ask for images designed for 160 DPI, and let Android scale everything up or down from there.

It turns out, however, that most of the current smartphones use screens with a density of 240 DPI — what Google calls high density, or HDPI.

Google actually keeps really useful statistics on the kinds of devices in use; at the time of this writing, 75% of the Android devices have HDPI displays:

Screen Sizes and Densities

Given this information, we decided to only ask our users for HDPI images. This way the apps will look best on HDPI devices, where image quality matters the most.

Since Android scales images quite well, things will still look good on other devices — maybe a little bit softer, but we feel it’s a worthwhile tradeoff in order to keep Andromo from getting too complicated.

(There are always tradeoffs; for example, your apps will be a bit smaller because they hold fewer images, but they will consume a bit more battery because the CPU will be used to do the resizing. We might choose to do the resizing to other densities like MDPI and LDPI ourselves, when building the apps, in order to offload that burden from the device CPU — but that’s something we can decide at a later date after collecting more field data and user feedback.)