Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

size of images in different screens

 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to handle different screen sizes in android.Anyway i found the below in android developer.



can anyone tell me above details for px values,because when we try to download pictures we found pictures in px values.not in dp .
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The measurements you gave are for screen density, in 'dots per inch', which is the same as 'pixels per inch' on a screen. There are a wide variety of screen sizes and screen density combinations, so categorizing screens by number of pixels ends up being very difficult. The majority of the reason you care about the number of pixels is based on the density, the number of pixels per inch. You want your assets / images to be clean and take up relatively the same physical size on all devices to make sure they are usable and nice looking.

So to do that, you decide how large, in inches, you want the asset to be. Say you want a particular image to be 1/4" x 1/4" in size. Then you decide how big that image has to be, in pixels, on an mdpi density: at 160dpi, for 1/4", that would be 40 pixels x 40 pixels. Then you convert to the other sizes by multiplying by the correct conversion: lpdi = 3/4 * mdpi (30x30 pixels), hdpi: 1.5 * mdpi (60x60 pixels), and xhdpi = 2 * mdpi (80x80 pixels).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic