Pixel to Centimeter?

前端 未结 9 1598
忘了有多久
忘了有多久 2020-11-29 02:35

I just want to know if the pixel unit is something that doesn\'t change, and if we can convert from pixels to let\'s say centimeters ?

9条回答
  •  再見小時候
    2020-11-29 02:59

    Similar to this question which asks about points instead of centimeters. There are 72 points per inch and there are 2.54 centimeters per inch, so just substitute 2.54 for 72 in the answer to that question. I'll quote and correct my answer here:

    There are 2.54 centimeters per inch; if it is sufficient to assume 96 pixels per inch, the formula is rather simple:

    centimeters = pixels * 2.54 / 96

    There is a way to get the configured pixels per inch of your display for Microsoft Windows called GetDeviceCaps. Microsoft has a guide called "Developing DPI-Aware Applications", look for the section "Creating DPI-Aware Fonts".

提交回复
热议问题