How to calculate the screen DPI?
As long as we know the screen resolution and size (diagonal line length), we can calculate the corresponding screen density, and then obtain the screen density according to its range.
Dpi can be calculated based on the length or width. The formula is as follows:
DPI = width/(size 2 x Width 2)/(width 2 + height 2) 1/2 = length/(size 2 x height 2) /(2 + 2 in width) 1/2
The approximate calculation method is as follows:
1. For example, if the resolution is 320 × 480, the aspect ratio is. 5.
2. For example, if the screen size is 3.6, the following elements are obtained based on the theorem:
Height 2 + width 2 = 3.62,
Also, because the height = 1.5 x width is substituted into the upper formula, there are:
Width 2 + 2.25 x Width 2 = 12.96,
It is concluded that the width is (12.96/3.25) 1/2 = 1.9969
3. The width is 320px and is distributed on 1.9969 ", so the density is 320/1 .9969 = 160.2467.
4. Therefore, this density is about the mdpi density.