I was reading dp, dip, px, sp measurements, but I still have some questions about dp/dpi vs ppi vs px vs inch. I am not able to compare them... is an inch the largest?
They say 160 dpi means 160 pixels per one inch. Does that mean 1 inch contains 160 pixels?
They also say 1 pixel on a 160 dpi screen = 1 dp. Does that mean 1 pixel and 1 dp are equal?
And lastly, why should we use dp instead of px? I understand that it is ideal, but why?
DPI refers to the number of printed dots contained within one inch of an image printed by a printer. PPI refers to the number of pixels contained within one inch of an image displayed on a computer monitor.
Image size is expressed as DPI (dots per inch) and PPI (pixels per inch). So, when you ask yourself, “what is 300 DPI in Pixels Per Inch per image,” the answer is 300 because 300 DPI in an image means there are 300 pixels per inch in your web design image.
Pixel density So, if you see 72 dpi it means that the image will have 72 pixels per inch; if you see 300 dpi means 300 pixels per inch, and so on. The final size of your image depends on the resolution that you choose.
A dp is equal to one physical pixel on a screen with a density of 160. To calculate dp: dp = (width in pixels *... A dp is equal to one physical pixel on a screen with a density of 160.
You should (almost) always use flexible sizing units, like dp
, which is Density-Independent Pixels, because 300px
on one device is not necessarily the same amount of screen real estate as 300px
on another. The biggest practical implication is that your layout would look significantly different on devices with a different density than the one your design targeted.
dp
or dip
means Density-independent Pixelsdpi
or ppi
means Dots (or Pixels) Per Inchinch
is a physical measurement connected to actual screen sizepx
means Pixels — a pixel fills an arbitrary amount of screen area depending on density.For example, on a 160dpi
screen, 1dp == 1px == 1/160in
, but on a 240dpi
screen, 1dp == 1.5px
. So no, 1dp != 1px
. There is exactly one case when 1dp == 1px
, and that's on a 160dpi
screen. Physical measurement units like inches should never be part of your design—that is, unless you're making a ruler.
A simple formula for determining how many pixels 1dp
works out to is px = dp * (dpi / 160)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With