像素到厘米?
我只是想知道像素单位是否是不变的,以及我们是否可以从像素转换为厘米?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
类似于这个问题它询问点而不是厘米。每英寸有 72 个点,每英寸有 2.54 厘米,因此在该问题的答案中只需用 2.54 代替 72 即可。我将在这里引用并更正我的答案:
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:
将像素转换为厘米取决于显示图像的介质(即显示器、激光打印机等)的 DPI(每英寸点数)。
http://wiki.answers.com/Q/How_do_you_convert_pixels_into_centimeters
Converting pixels to centimeters depends on the DPI (dots per inch) of the media displaying the image, i.e. monitor, laser printer, etc.
http://wiki.answers.com/Q/How_do_you_convert_pixels_into_centimeters
我将大胆猜测您希望能够在用户的显示器上向用户显示内容,并缩放到非常接近其真实大小。
如果是这种情况,我建议将您的物品显示在现实生活中的物品(信用卡、美元钞票、易拉罐等)旁边,或者更好的是,允许用户将某些物品举到屏幕上,例如信用卡或美元帐单或尺子。然后,您可以让它们缩放滑块或类似的东西以满足该对象的宽度或高度。
通过将信用卡(具有相对已知的高度和宽度的东西)放在屏幕上,您可以轻松确定像素与英寸的比率,并根据您的喜好使用它。
维基说
使用 mspaint,我的信用卡正好是 212 像素高,即 53.98mm / 212像素 = 3.92 像素/毫米。乘以 10,即每厘米 39.2 像素。
您可以通过 javascript、C#、flash 等任何您想要的方式轻松地以编程方式完成此操作。
I'm going to go out on a limb and just guess that you want to be able to display things to the user on their monitor, scaled to be very close to its real life size.
IF this is the case, I would recommend either displaying your items next to real life items (credit cards, dollar bills, pop cans, etc) or even better, allow the user to hold something up to the screen like a credit card or dollar bill or ruler. You could then have them scale a slider or something similar to meet the width or height of that object.
By holding a credit card, something with a relatively known height and width, up to the screen, you can easily determine the ratio of pixels to inches and use that to your hearts content.
Wiki says
Using mspaint, a credit card of mine is exactly 212 pixels tall, thats 53.98mm / 212 pixels = 3.92 pixels per mm. Multiply by 10 and that's 39.2 pixels per cm.
You could EASILY do that programatically via javascript, C#, flash, whatever you want.
您可以从像素转换为厘米,但这不是一致的转换。这将取决于相关显示设备的尺寸和分辨率。像素的清晰度不会改变,但像素的大小在不同的显示设备上会有所不同。
You can convert from pixels to centimeters, but it's not a consistent conversion. It will depend on the size and resolution of the display device in question. The definition of a pixel will not change, but the size of a pixel will vary on different display devices.
不,不同的媒介&显示器具有不同的像素密度。
例如,桌面显示器每英寸可能有 75 个像素,而打印输出的像素可能为 300。
以下是显示器列表 按像素密度
No, different mediums & monitors have different pixel density.
For instance a desktop monitor may have 75 pixels per inch whereas a print may be outputted at 300.
Here is a list of displays by pixel density
在 Adobe Illustrator CS3 :( 中,我得到的数字是 1 厘米 = 28.347 像素。请注意,我使用的是 iMac 7。根据链接 http://en.wikipedia.org/wiki/List_of_displays_by_pixel_desired 由 rebo 提供。
我使用 javascript 创建了一个 Adobe Illustrator CS3 文档来测试值 1 厘米 = 28.347 像素,它完全匹配
问题很老,但我试图找到它的答案并决定分享我的发现。
我知道这个
In Adobe Illustrator CS3 :(, the figure I get is 1 cm = 28.347 pixels. Note I am using an iMac 7. that has a resolution of 102 pixels per inch, 40 ppcm according to the link http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density provided by rebo.
I created an Adobe Illustrator CS3 document using javascript to test the value of 1 cm = 28.347 pixels and it matches perfectly.
I know this question is very old but I was trying to find an answer to it and decided to share my findings.
Regards
像素系统取决于您的屏幕分辨率。
好吧,首先您应该获取屏幕的 dpi(每英寸密度像素)。
例如你的屏幕dpi是96;
1 CM = 37.795276F 像素(96dpi)。
37.795276F / 96F = 0.03937007F,即 1dpi 中的每个像素。
现在您可以通过获取屏幕的当前 dpi 并将其乘以 0.03937007F 来使其适应您的屏幕。然后你就有了你想要的 dpi(屏幕分辨率)中的每一厘米,
让我们设置场景。
我想制作一个方法来获取 CM 并返回屏幕 Dpi 上的像素基础;
如果你想让它更准确,你必须接近 dpiX & dpiY。
例如,在 C# winforms 中,您可以添加 Graphics 对象
System.Drawing 和 System.Drawing.Drawing2D 然后获取 dpiX & dpiY 值并根据它设计您的区域以进行更准确的计算(在某些情况下水平分辨率与垂直分辨率不同)。
请参阅下面的代码。
希望它能帮助你,海达尔。
The pixel system is that it depend on your screen resolution.
Well , first you should get the dpi(density pixel perInch) of your screen.
For example your screen dpi is 96;
1 CM = 37.795276F Pixel in 96dpi.
37.795276F / 96F = 0.03937007F which is each pixel in 1dpi.
now you can make it adapted to your screen by getting the current dpi of screen and multiply it to 0.03937007F. then you have each Centimeter in your desire dpi(screen resolution)
lets set scenario .
I want to make a methode which get CM and return pixel base on screen Dpi;
if you want to make it more accurate you have to approach dpiX & dpiY.
for example in C# winforms You can add an object of Graphics from
System.Drawing And System.Drawing.Drawing2D then Get it dpiX & dpiY value and design youre area based on it to have more acurate calculation(in some case that horizontal resolution differ from vertical).
See the code bellow.
Whish it help you, Heydar.
像素的大小根据显示设备而变化。
以下“找到”代码使用 api 调用来确定像素密度 获取 . NET
(“找到”,因为我用谷歌搜索了它,但还没有尝试过)
The size of pixels change depending on the display device.
The following "found" code uses api calls to determine pixel density Get screen DPI in .NET
("Found" as in I googled it but haven't tried it)
据我了解,像素是:
取决于两件事:
(a) 分辨率
(b) 物理屏幕尺寸
因此,如果将屏幕尺寸除以分辨率,则应得到每像素 CM。
As far as I understand it, a PIXEL is:
thus it depends on two things:
(a) Resolution
(b) Physical Screen size
Thus if you divide screen size by resolution, this should give you CM per Pixel.