问题描述
我必须使用javascript将px转换为cm
i must convert px to cm with javascript
oneCM = 37.795276每次都是真的吗?
oneCM= 37.795276 is it true everytime?
什么DPI的角色在这里?
What is the DPI's role here?
,如果监视器上的CM是变量CM(因数DPI),我们如何找到DPI的
and if is variable CM on the monitor (factor DPI) how can we find DPI's
推荐答案
您要DPI还是PPI? -DPI用于打印,PPI用于屏幕。
Do you want DPI or PPI? - DPI is for printing, PPI for screens.
如果您在谈论屏幕上图像或网页的实际尺寸,我们在谈论PPI。 。普通的PC屏幕大约有80ppi,macbook pro的分辨率为220ppi。
If you are talking about the "real" size of an image or a webpage on your screen we're talking about PPI. Common PC screens have approx. 80ppi, the macbook pro has 220ppi.
如果要转换这些尺寸,首先必须将所需尺寸从cm转换为英寸,然后将其与所需ppi相乘。 。
If you want to convert those, you first have to convert your wanted size from cm to inches and then multiply it with the wanted ppi.
1cm = 0.39inches
0.39inches * 80dpi = 31.5px
反之亦然:
900px / 80ppi = 11.25inches
11.25inches = 28.575cm
与DPI相同用于打印。您必须知道打印机的DPI(普通打印机的DPI为72dpi,商用打印机的DPI为150-600dpi)。
The same works with DPI for printing. You have to know the DPI of your printer (common printes have 72dpi, commercial printers have something between 150 - 600dpi).
这篇关于Pixel 2 CM转换Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!