I'm a bit confused as to what resolutions I should be saving my images in for the different drawable folders. Is there a general formula for it? For example,if I want an image to take up 10% of the height and the full width of the screen, roughly how would I calculate what different resolutions I should save the image in?
3 Answers
This is android's guidelines for icons. Obviously not all drawables are icons, but maybe this helps you get started.
- 36x36 for low-density
- 48x48 for medium-density
- 72x72 for high-density
- 96x96 for extra high-density
From here: http://developer.android.com/guide/practices/screens_support.html

- 2,680
- 2
- 25
- 29
-
Good answer @NeilMonday, I gived a similar question. +1 for you. – Milos Cuculovic Dec 11 '12 at 16:48
-
Yes this is what I mean. I already knew about the icon sizes but was looking for some general guidelines for figuring out what size to save pngs, jpegs, etc. I guess I'll just have to estimate. Thanks. – CoffeeCrisp Dec 11 '12 at 23:00
-
1See the answer I provided here: http://stackoverflow.com/questions/4833588/android-multiple-image-density-support-scale-height-width-and-dpi/19993455#19993455 – BVB Nov 15 '13 at 04:21
-
http://stackoverflow.com/questions/16706076/font-size-and-images-for-different-devices – Bhavesh Jethani Jul 24 '14 at 09:32
-
if I have a png image with 50*50 px size on drawable-mdpi,what is size for xlarge-xhdpi drawable? – S.M_Emamian Aug 06 '14 at 19:36
-
The way I create my images in 4 dimensions are like this. I set the drawables for a high resolution screen like NEXUS 5 (xxhdpi) and then when that image looks perfect i prepare the images for the rest of the dpis using the above ratio. Am I on the right track ? – Sagar Devanga Aug 26 '15 at 12:51
According to android documentation here
http://developer.android.com/guide/practices/screens_support.html#range
In mdpi (baseline density) 1px = 1dp
and under topic 'Range of screens supported' least resolution for a normal size screen(baseline size) in dp is
470dp X 320dp and since in baseline density 1px = 1dp so baseline screen size in pixels would be
470px X 320px
now for baseline screen size and density 10% of 470px would be 47px and full width is 320px so your baseline drawable will have the following size in pixels
47px X 320px
The scaling ratios for alternative drawables is 3:4:6:8 for ldpi:mdpi:hdpi:xhdpi
this means that the above baseline resolution of your graphic is at scale 4. Now to get resolutions for your graphic in other densities we need to divide the mdpi graphic resolution with 4 to get the unit values
height unit = 47/4 = 11.75
width unit = 320/4 = 80
now reoultions in other densities can be calculated by multiplying unit values with respective scaling ratios
ldpi
11.75 X 3 = 35.25px
80 X 3 = 240px
mdpi (already calculated above, doing it again here for clarity)
11.75 X 4 = 47px
80 X 4 = 320px
hdpi
11.75 X 6 = 70.5px
80 X 6 = 480px
xhdpi
11.75 X 8 = 94px
80 X 8 = 640px

- 101
- 1
- 2
-
So If I for example have a 100x100 image in photoshop that I need to use in my app, I would create/multiply my image to each screen density to come up with the correct image? – SleepNot Oct 10 '13 at 02:01
There are different guidelines on Android developer site about how to manage the image size and resolution to support multiple screens.
Refer this How to develop one android application for different screens?