Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I prepare images for all the Android resolutions?

In iOS preparing graphics is simple. There are either a normal image (height x width) or a retina image which is @2x (2 times height x 2 times width).

However, since I'm new to Android, I see a ton of drawable-* folders in Eclipse where the * can be "hdpi" or "ldpi" or "mdpi" or "xhdpi" or "xxhdpi". Can someone very clearly and simply list for me what I must do to satisfy each of the display possibilities so my images will look right in each instance? I'm envisioning an answer will be a bullet list with each "*" listed and a sub-bullet list including the things that must be done.

I'd also really enjoy an answer that would start with the highest density and greatest dimension image and working down since I'll be creating in Photoshop and will be reducing quality from a master image.

like image 414
Art Geigel Avatar asked May 03 '13 04:05

Art Geigel


People also ask

What is the best image size for Android?

The best image resolution for most smartphones is 640 by 320 pixels, although you should ideally maintain the aspect ratio of the original image or the output image will be distorted.

What is used for resolution in Android?

Android screen resolutions fall into certain ranges, which are represented by baskets: ldpi – ~120dpi. mdpi – ~160dpi. hdpi – ~240dpi.


1 Answers

i got this off of this site a while back, it still comes in handy

xlarge screens are at least 960dp x 720dp large screens are at least 640dp x 480dp normal screens are at least 470dp x 320dp small screens are at least 426dp x 320dp Generalised Dpi values for screens:  ldpi Resources for low-density (ldpi) screens (~120dpi) mdpi Resources for medium-density (mdpi) screens (~160dpi). (This is the baseline density.) hdpi Resources for high-density (hdpi) screens (~240dpi). xhdpi Resources for extra high-density (xhdpi) screens (~320dpi). Therefore generalised size of your resources (assuming they are full screen):  ldpi Vertical = 426 * 120 / 160 = 319.5px Horizontal = 320 * 120 / 160 = 240px mdpi Vertical = 470 * 160 / 160 = 470px Horizontal = 320 * 160 / 160 = 320px hdpi Vertical = 640 * 240 / 160 = 960px Horizontal = 480 * 240 / 160 = 720px xhdpi Vertical = 960 * 320 / 160 = 1920px Horizontal = 720 * 320 / 160 = 1440px  px = dp*dpi/160 
like image 152
JRowan Avatar answered Oct 30 '22 05:10

JRowan