21

I encountered this concept: device pixel ration, some said it is the ratio between physical pixels and logical pixels.

For example iPhone has:

  • Physical resolution: 960 x 640
  • Logical resolution: 480 x 320

so does it mean that the height of each physical pixel is the screen height/960 ? And the height of each logical pixel is equal to twice the height of the Physical pixel?

Blake
  • 7,367
  • 19
  • 54
  • 80
  • On that post, they say the opposite: http://stackoverflow.com/questions/8785643/what-exactly-is-device-pixel-ratio – user1835565 Jul 31 '14 at 12:13
  • 2
    The problem is those pesky new high resolution screens -- or, rather, legacy web pages (and to a lesser extent, applications) that specify positions and sizes in `px` *pixels*. When taken literally, every web page would appear way too small. So Apple invented the "logical pixel" measurement unit, whereas "physical pixels" are the ones you would see. (If only they weren't so darn small.) – Jongware Jul 31 '14 at 12:14
  • @Jongware thanks! How about the `device independent pixels`, is it something similar to logical pixel? – Blake Jul 31 '14 at 12:19
  • @Jongware LOL, I got it from http://msdn.microsoft.com/en-us/library/windows/desktop/ff684173(v=vs.85).aspx , and I still don't quite get it after reading the article... – Blake Jul 31 '14 at 13:02

3 Answers3

10

We can say that 4 physical pixels make 1 logical pixel ;-)

In other words: most recent retina displays have much more pixels than original iPhone, but to maintain compatibility and "visual size" software use 4 physical pixel to render a unique logical pixel.

Kennet Celeste
  • 4,593
  • 3
  • 25
  • 34
Luca Detomi
  • 5,564
  • 7
  • 52
  • 77
4

You can take a look at the site below:

http://www.iosres.com

For iPhone 4s logical screen resolution is half of the actual resolution (not include in the site above).

Vas Giatilis
  • 1,086
  • 12
  • 16
0

This article refers to what you call logical pixels as points on iPhone and independent pixels (DP) on Android.

It provides formulas on how to convert logical pixels to physical ones.

iOS:

physical pixels = points * DPI / 163

Android:

physical pixels = independent pixels * DPI / 163

DPI (aka PPI) is a Dot Per Inch or Pixel Per Inch is the number of physical pixels per inch.

Physical screen resolution and PPI can be easily obtained from sites like GSMArena. But as developers, we are more interested in logical resolution, and especially logical width.

Let's calculate the logical width for iPhone 14. Its physical resolution and PPI are 1170 x 2532 and 460 respectively:

logical width = 1170 * 163 / 460 = 415

For Samsung S23 (1440 x 3088 and 500 ppi):

logical width = 1440 * 160 / 500 = 460

For iPhone 5 (640 x 1136 and 326)

 logical width = 640 * 163 / 326 = 320
Yuriy N.
  • 4,936
  • 2
  • 38
  • 31