How to calculate device pixel ratio

Adityaraj Pednekar

I would like to know how the -webkit-device-pixel-ratio is calculated. I had already read this. Yet I am unable to understand it clearly. I would also like to know if there is a list of which devices use which pixel ratio. The android website says

The Android Browser and WebView support a CSS media feature that allows you to create styles for specific screen densities—the -webkit-device-pixel-ratio CSS media feature. The value you apply to this feature should be either "0.75", "1", or "1.5", to indicate that the styles are for devices with low density, medium density, or high density screens, respectively.

but I found that we need to use -webkit-device-pixel-ratio=2 to make a web application compatible on 768 x 1280 resolution screen.

Jet Blue

According to this article

http://www.html5rocks.com/en/mobile/high-dpi/

The magic number seems to be 150.

Dividing the physical ppi by the ideal ppi of 150, gives the device pixel ratio.

E.g. a device with 445ppi would have a dpr of 3 ->> 445 / 150

The simple calculation seems to hold up okay for many items on this list,

http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to calculate the pixel density (dp) of a device?

what exactly is device pixel ratio?

Device pixel ratio without the BuildContext

Font-size and device-pixel-ratio

Understanding responsive images and device pixel ratio

calculate the pixel ratio of two halves of an image

How to display a specific size image using SRCSET no matter what the device's pixel ratio is?

how to calculate proportional ratio

How to calculate ratio in Mysql?

What is the view port width, height and device pixel ratio for the devices Google Pixel and Google Pixel XL

Retina - Correlation between device pixel ratio and size of image?

Where I can find the Pixel Ratio of the device detail?

-webkit-min-device-pixel-ratio gives a CSS validation error

How to calculate Image compression ratio?

How to calculate percentage ratio with mpi?

Responsive Design: max-device-width, max-width and min-device-pixel-ratio

How to keep the aspect ratio when changing device?

How to more efficiently calculate a rolling ratio

How to calculate the aspect ratio by a given factor?

How to calculate the ratio using two hashmaps in java

How to calculate ratio between numbers in a vector?

How to calculate ratio to the rowmean using dplyr

How to calculate odds ratio with beta value in R

How to calculate hazard ratio with coxph output

Android : How to calculate aspect ratio of images?

How to aggregate two numerical variables then calculate the ratio

How to calculate ratio of values in a pandas dataframe column?

how to calculate signal to noise ratio using python

How to calculate the ratio per columns in python?