Pixel to Centimeter?

Nassif Bourguig picture Nassif Bourguig · Aug 27, 2009 · Viewed 98.1k times · Source

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 ?

Answer

Mark Ransom picture Mark Ransom · Aug 27, 2009

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".