Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMustafa Ogün Öztürk
3,468 PointsImage Resolutions for Android Screens
Hi all
Let's say i have a lot of images to be used in my Android app and as we already know there are a lot of different screen sizes for Android devices. In order to prepare images for my app, what should be the resolutions of images for different screen sizes ?
Thanks in advance
2 Answers
Daniel Hartin
18,106 PointsHi,
The answer is not so easy, it depends on the size of the image and how you want it to display on the device. What you have to understand is a pixel is not a fixed size height and width sharper screens have a greater pixel density and as such display images with a higher resolution while screens with a lower pixel density will still display the image as the same physical size (relative to screen size) but the number of pixels will be reduced.
Why does this even matter then if Android just resizes images to the correct size?
Well just like in a graphics editor such as paint when you get a bitmap and scale the image up the computer best guesses what those pixels should be and it generally results in a poor or blurry image, the same happens when the image gets scaled down to much, colours begin to run into each other as the image has to lose some of these pixels and the computer again guesses. Generally speaking you want images for xxhdpi and xhdpi and hdpi. There are so few screens with mdpi using my apps that I don't bother supporting it I just let android scale down the hdpi images. There is a scale detailing the screen density's here http://iconhandbook.co.uk/reference/chart/android/
What you need to determine is how big the image will be in physical size and then using a formula extrapolated from the dpi rating of each screen group to get the respective pixel width and height. This can get a bit tiresome so it's up to you how many of the images you duplicate as you don't have to duplicate them all you can always put the nicer big images in your app into the respective sizes and then different folders and just throw everything else in the standard drawable folder and let android figure it out :) it depends how critical you are with your image appearance.
There is also a performance bonus by android not having to use a matrix to scale the images considerably but you do bulk up the app .apk file size so you may have to trade off the 2 to find a happy medium.
Hope this helps Daniel
Daniel Hartin
18,106 PointsHi Mustafa,
I'm an android developer for a medium sized business in the UK employing just over 1,000 staff and at my company we have a graphic designer who knows little about the intricacies of mobile development but is a great designer. I usually give him the specs of the images I require width and height file type etc and he does the visual magic and gives me the image. Generally speaking as a developer you shouldn't make an image as your time is better spent making it animate/talk to servers/do coding black magic :)
I do sometimes take images he gives me and make minor adjustments in GIMP if I need an entirely white icon changing to black or something similar but I have no idea how to work adobe to any great degree.
It will depend on the size of the company you work for and what experience you have I suppose in the end a startup for example may need someone who can fill multiple roles but I wouldn't expect it to be a requirement if I went to a job interview for a developer title to be expected to make the images only know what images you need in which format etc.
Hope this helps Daniel
Mustafa Ogün Öztürk
3,468 PointsMustafa Ogün Öztürk
3,468 PointsThanks for the detailed explanation Daniel. As an Android developer, is it my responsibility to design all the screens and these image sizes or there will be a graphic designer to do this for me ?