Search code examples
htmlcsspixel

Converting cm to pixel, formula for conversion?


I'm getting cm as an input value and I want to convert the integer to pixel (doesn't need to be absolutely precise). Is there a formula to do this?


Solution

  • Two screens with the same resolution can be of two completely different sizes, it all depends on the pixel density, so you can't convert pixels to centimeters without knowing it.

    For example, if you use a projector, the projected image can be two meters wide, but it still has just as many pixels as it has on your 15" laptop screen.

    Look here : https://en.wikipedia.org/wiki/Pixel_density