I use Xiaomi's Redmi Note 9 Pro. The screen resolution of my phone is 1080x2400. But when I print the size of my phone's height and width using Dart and Flutter, I get 393x857.
I'm trying to find the corelation between the two. But not able to.
Also for iPhoneX the actual resolution is 1125x2436 but using the chrome dev tools I found out it's 375x812.
I have read several articles on ppi, aspect ratio and other similar stuff and finally I'm putting it here to learn their corelation.
Please tell me for any given pixel, 1125x2436 how to derive 375x812?
Through some research and learning, I've managed to uncover the correlation between these two sets of numbers, and I'd like to share my understanding here.
Physical Pixels vs. Logical Pixels:
Device Pixel Ratio (DPR):
Calculating Logical Resolution from Physical Resolution
To bridge the gap between the two types of pixels, I've found that I can derive the logical resolution from the physical resolution using the device's DPR:
For instance, let's take the iPhone X with a physical resolution of 1125x2436 and a DPR of 3.0:
Logical Resolution:
By applying this calculation, I can understand why my layout tools might display 375x812 for my iPhone X.