像素到厘米?

发布于 2024-08-03 07:27:22 字数 41 浏览 7 评论 0原文

我只是想知道像素单位是否是不变的,以及我们是否可以从像素转换为厘米?

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

习惯成性 2024-08-10 07:27:22

类似于这个问题它询问点而不是厘米。每英寸有 72 个点,每英寸有 2.54 厘米,因此在该问题的答案中只需用 2.54 代替 72 即可。我将在这里引用并更正我的答案:

每英寸有2.54厘米;如果假设每英寸 96 像素就足够了,那么公式就相当简单:

厘米 = 像素 * 2.54 / 96

有一种方法可以获取 Microsoft Windows 显示器的每英寸配置像素,称为 GetDeviceCaps。 Microsoft 有一个名为“开发 DPI 感知应用程序”的指南,请查找“创建 DPI 感知字体”部分。

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

时光无声 2024-08-10 07:27:22

将像素转换为厘米取决于显示图像的介质(即显示器、激光打印机等)的 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

电影里的梦 2024-08-10 07:27:22

我将大胆猜测您希望能够在用户的显示器上向用户显示内容,并缩放到非常接近其真实大小。

如果是这种情况,我建议将您的物品显示在现实生活中的物品(信用卡、美元钞票、易拉罐等)旁边,或者更好的是,允许用户将某些物品举到屏幕上,例如信用卡或美元帐单或尺子。然后,您可以让它们缩放滑块或类似的东西以满足该对象的宽度或高度。

通过将信用卡(具有相对已知的高度和宽度的东西)放在屏幕上,您可以轻松确定像素与英寸的比率,并根据您的喜好使用它。

维基说

大多数信用卡由当地银行或信用合作社发行,其形状和大小由 ISO/IEC 7810 标准 作为 ID-1 (85.60 × 53.98 mm)

使用 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

Most credit cards are issued by local banks or credit unions, and are the shape and size specified by the ISO/IEC 7810 standard as ID-1 (85.60 × 53.98 mm)

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.

葬花如无物 2024-08-10 07:27:22

可以从像素转换为厘米,但这不是一致的转换。这将取决于相关显示设备的尺寸和分辨率。像素的清晰度不会改变,但像素的大小在不同的显示设备上会有所不同。

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.

山田美奈子 2024-08-10 07:27:22

不,不同的媒介&显示器具有不同的像素密度。

例如,桌面显示器每英寸可能有 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

丢了幸福的猪 2024-08-10 07:27:22

在 Adob​​e Illustrator CS3 :( 中,我得到的数字是 1 厘米 = 28.347 像素。请注意,我使用的是 iMac 7。根据链接 http://en.wikipedia.org/wiki/List_of_displays_by_pixel_desired 由 rebo 提供。

我使用 javascript 创建了一个 Adob​​e 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

过潦 2024-08-10 07:27:22

像素系统取决于您的屏幕分辨率。
好吧,首先您应该获取屏幕的 dpi(每英寸密度像素)。
例如你的屏幕dpi是96;

1 CM = 37.795276F 像素(96dpi)。

37.795276F / 96F = 0.03937007F,即 1dpi 中的每个像素。

现在您可以通过获取屏幕的当前 dpi 并将其乘以 0.03937007F 来使其适应您的屏幕。然后你就有了你想要的 dpi(屏幕分辨率)中的每一厘米,

让我们设置场景。

我想制作一个方法来获取 CM 并返回屏幕 Dpi 上的像素基础;

public float CentimeterToPixel(int valueCM, float dpi)
{
   return 0.03937007F * dpi * valueCM;
}

如果你想让它更准确,你必须接近 dpiX & dpiY。

例如,在 C# winforms 中,您可以添加 Graphics 对象
System.DrawingSystem.Drawing.Drawing2D 然后获取 dpiX & dpiY 值并根据它设计您的区域以进​​行更准确的计算(在某些情况下水平分辨率与垂直分辨率不同)。
请参阅下面的代码。

using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;

namespace MyApp
{
    static class MyAppClass
    {
        private static Bitmap bmp = new Bitmap(1, 1);// a simple bitmap that automaticaly created base on current screen resolution
        private static Graphics graphic = Graphics.FromImage(bmp);

        public static float CentimeterToPixelWidth(int valueCM)
        {
           return 0.03937007F * graphic.DpiX * valueCM;
        }

        public static float CentimeterToPixelHeight(int valueCM)
        {
           return 0.03937007F * graphic.DpiY * valueCM;
        }
    }

}

希望它能帮助你,海达尔。

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;

public float CentimeterToPixel(int valueCM, float dpi)
{
   return 0.03937007F * dpi * valueCM;
}

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.

using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;

namespace MyApp
{
    static class MyAppClass
    {
        private static Bitmap bmp = new Bitmap(1, 1);// a simple bitmap that automaticaly created base on current screen resolution
        private static Graphics graphic = Graphics.FromImage(bmp);

        public static float CentimeterToPixelWidth(int valueCM)
        {
           return 0.03937007F * graphic.DpiX * valueCM;
        }

        public static float CentimeterToPixelHeight(int valueCM)
        {
           return 0.03937007F * graphic.DpiY * valueCM;
        }
    }

}

Whish it help you, Heydar.

最终幸福 2024-08-10 07:27:22

像素的大小根据显示设备而变化。

以下“找到”代码使用 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)

隔岸观火 2024-08-10 07:27:22

据我了解,像素是:

图片元素

取决于两件事:

(a) 分辨率
(b) 物理屏幕尺寸

因此,如果将屏幕尺寸除以分辨率,则应得到每像素 CM。

As far as I understand it, a PIXEL is:

Picture Element

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文