This is some miscellaneous code I need when evaluating tablets.
Often we are presented with size information from a manufacturer like resolution and diagonal length.
For example the a pen display is specified as HD (1920x1080) with a diagonal length of 13.3". But we may not be given the physical height and width. This function calculates the height and width given the aspect ratio and the diagonal length.
In this case it would be called like this (this assumes the pixels are square):
Or if you know the aspect ratio is 16/9
ISO A0
1189mm x 841mm
46.8" x 33.1"
14:10 (1.4)
57.3"
ISO A1
841mm x 594mm
33.1" x 23.4"
14:10 (1.4)
40.5"
ISO A2
594mm x 420mm
23.4" x 16.5"
14:10 (1.4)
28.6"
ISO A3
420mm x 297mm
16.5" x 11.7"
14:10 (1.4)
20.2"
ISO A4
297mm x 210mm
11.7" x 8.3"
14:10 (1.4)
14.3"
ISO A5
210mm x 148mm
8.3" x 5.8"
14:10 (1.4)
10.1"
ISO A6
148mm x 105mm
5.8" x 4.1"
14:10 (1.4)
7.1"
ISO A7
105mm x 74mm
4.1" x 2.9"
14:10 (1.4)
5.0"
US Letter
279.4mm x 215.9mm
11" x 8.5"
13:10 (1.3)
13.9"
US Legal
355.6mm x 215.9mm
14" x 8.5"
16:10 (1.6)
16.4"
US Tabloid
431.8mm x 279.4mm
17" x 11"
15:10 (1.5)
20.2"
1600x1200
4x3
10"
8.7"x4.9"
184 ppi
1600x1200
4x3
11"
9.6"x5.4"
167 ppi
1600x1200
4x3
12"
10.5"x5.9"
153 ppi
1600x1200
4x3
13"
11.3"x6.4"
141 ppi
1600x1200
4x3
14"
12.2"x6.9"
131 ppi
1600x1200
4x3
15"
13.1"x7.4"
122 ppi
1600x1200
4x3
16"
13.9"x7.8"
115 ppi
1600x1200
4x3
17"
14.8"x8.3"
108 ppi
1600x1200
4x3
18"
15.7"x8.8"
102 ppi
1600x1200
4x3
19"
16.6"x9.3"
97 ppi
1600x1200
4x3
20"
17.4"x9.8"
92 ppi
1600x1200
4x3
21"
18.3"x10.3"
87 ppi
1600x1200
4x3
22"
19.2"x10.8"
83 ppi
1600x1200
4x3
23"
20.0"x11.3"
80 ppi
1600x1200
4x3
24"
20.9"x11.8"
76 ppi
1600x1200
4x3
27"
23.5"x13.2"
68 ppi
1600x1200
4x3
32"
27.9"x15.7"
57 ppi
1600x1200
4x3
43"
37.5"x21.1"
43 ppi
1600x1200
4x3
50"
43.6"x24.5"
37 ppi
Resolution
Aspect ratio
Diagonal
Size
PPI
1920x1080
16x9
10"
8.7"x4.9"
220 ppi
1920x1080
16x9
11"
9.6"x5.4"
200 ppi
1920x1080
16x9
12"
10.5"x5.9"
184 ppi
1920x1080
16x9
13"
11.3"x6.4"
169 ppi
1920x1080
16x9
14"
12.2"x6.9"
157 ppi
1920x1080
16x9
15"
13.1"x7.4"
147 ppi
1920x1080
16x9
16"
13.9"x7.8"
138 ppi
1920x1080
16x9
17"
14.8"x8.3"
130 ppi
1920x1080
16x9
18"
15.7"x8.8"
122 ppi
1920x1080
16x9
19"
16.6"x9.3"
116 ppi
1920x1080
16x9
20"
17.4"x9.8"
110 ppi
1920x1080
16x9
21"
18.3"x10.3"
105 ppi
1920x1080
16x9
22"
19.2"x10.8"
100 ppi
1920x1080
16x9
23"
20.0"x11.3"
96 ppi
1920x1080
16x9
24"
20.9"x11.8"
92 ppi
1920x1080
16x9
27"
23.5"x13.2"
82 ppi
1920x1080
16x9
32"
27.9"x15.7"
69 ppi
1920x1080
16x9
43"
37.5"x21.1"
51 ppi
1920x1080
16x9
50"
43.6"x24.5"
44 ppi
Resolution
Aspect ratio
Diagonal
Size
PPI
2560x1440
16x9
10"
8.7"x4.9"
294 ppi
2560x1440
16x9
11"
9.6"x5.4"
267 ppi
2560x1440
16x9
12"
10.5"x5.9"
245 ppi
2560x1440
16x9
13"
11.3"x6.4"
226 ppi
2560x1440
16x9
14"
12.2"x6.9"
210 ppi
2560x1440
16x9
15"
13.1"x7.4"
196 ppi
2560x1440
16x9
16"
13.9"x7.8"
184 ppi
2560x1440
16x9
17"
14.8"x8.3"
173 ppi
2560x1440
16x9
18"
15.7"x8.8"
163 ppi
2560x1440
16x9
19"
16.6"x9.3"
155 ppi
2560x1440
16x9
20"
17.4"x9.8"
147 ppi
2560x1440
16x9
21"
18.3"x10.3"
140 ppi
2560x1440
16x9
22"
19.2"x10.8"
134 ppi
2560x1440
16x9
23"
20.0"x11.3"
128 ppi
2560x1440
16x9
24"
20.9"x11.8"
122 ppi
2560x1440
16x9
27"
23.5"x13.2"
109 ppi
2560x1440
16x9
32"
27.9"x15.7"
92 ppi
2560x1440
16x9
43"
37.5"x21.1"
68 ppi
2560x1440
16x9
50"
43.6"x24.5"
59 ppi
Resolution
Aspect ratio
Diagonal
Size
PPI
2560x1600
16x10
10"
8.7"x4.9"
294 ppi
2560x1600
16x10
11"
9.6"x5.4"
267 ppi
2560x1600
16x10
12"
10.5"x5.9"
245 ppi
2560x1600
16x10
13"
11.3"x6.4"
226 ppi
2560x1600
16x10
14"
12.2"x6.9"
210 ppi
2560x1600
16x10
15"
13.1"x7.4"
196 ppi
2560x1600
16x10
16"
13.9"x7.8"
184 ppi
2560x1600
16x10
17"
14.8"x8.3"
173 ppi
2560x1600
16x10
18"
15.7"x8.8"
163 ppi
2560x1600
16x10
19"
16.6"x9.3"
155 ppi
2560x1600
16x10
20"
17.4"x9.8"
147 ppi
2560x1600
16x10
21"
18.3"x10.3"
140 ppi
2560x1600
16x10
22"
19.2"x10.8"
134 ppi
2560x1600
16x10
23"
20.0"x11.3"
128 ppi
2560x1600
16x10
24"
20.9"x11.8"
122 ppi
2560x1600
16x10
27"
23.5"x13.2"
109 ppi
2560x1600
16x10
32"
27.9"x15.7"
92 ppi
2560x1600
16x10
43"
37.5"x21.1"
68 ppi
2560x1600
16x10
50"
43.6"x24.5"
59 ppi
Resolution
Aspect ratio
Diagonal
Size
PPI
3840x2160
16x9
10"
8.7"x4.9"
441 ppi
3840x2160
16x9
11"
9.6"x5.4"
401 ppi
3840x2160
16x9
12"
10.5"x5.9"
367 ppi
3840x2160
16x9
13"
11.3"x6.4"
339 ppi
3840x2160
16x9
14"
12.2"x6.9"
315 ppi
3840x2160
16x9
15"
13.1"x7.4"
294 ppi
3840x2160
16x9
16"
13.9"x7.8"
275 ppi
3840x2160
16x9
17"
14.8"x8.3"
259 ppi
3840x2160
16x9
18"
15.7"x8.8"
245 ppi
3840x2160
16x9
19"
16.6"x9.3"
232 ppi
3840x2160
16x9
20"
17.4"x9.8"
220 ppi
3840x2160
16x9
21"
18.3"x10.3"
210 ppi
3840x2160
16x9
22"
19.2"x10.8"
200 ppi
3840x2160
16x9
23"
20.0"x11.3"
192 ppi
3840x2160
16x9
24"
20.9"x11.8"
184 ppi
3840x2160
16x9
27"
23.5"x13.2"
163 ppi
3840x2160
16x9
32"
27.9"x15.7"
138 ppi
3840x2160
16x9
43"
37.5"x21.1"
102 ppi
3840x2160
16x9
50"
43.6"x24.5"
88 ppi