根据 DPI 和物理尺寸计算像素
我正在尝试为 Android 制作 Evolus Pencil 模板。我的设备有一个 1.75x2.5625" 屏幕,我想模拟这些精确的物理尺寸。阅读这篇文章: 具有相同密度的 Android 多种屏幕尺寸 我看到物理尺寸=像素/密度。因此,如果我在 96dpi 的屏幕上创建一个 168px 宽的图像,我是否应该得到一个 168/96=1.75" 宽的物理图像?
因为我得到一个大约 1.5" 的图像,我迷失了。我正在运行 Ubuntu 并使用 xdpyinfo 确认我的屏幕 dpi 为 96x96。那么我可以使用什么公式呢?我本以为可以通过将屏幕上所需的英寸数乘以屏幕的 dpi 来获得所需的像素,但这给了我上面提到的 168 ,显然我一无所获。
谁能指出我正确的方向,老实说,我对数字和数学很糟糕,所以如果我错过了一些简单或明显的东西,我很抱歉。
I'm trying to make an Evolus Pencil template for Android. My device has a 1.75x2.5625" screen, and I would like to emulate these exact physical dimensions. From reading this post:
Android multiple screen sizes with same density
I see Physical Size = Pixels / Density. So if I create an image that is 168px wide, on a 96dpi screen, should I not get a physical image of 168/96=1.75" wide?
Because I get one about 1.5" and I'm lost. I am running Ubuntu and confirmed my screen dpi with xdpyinfo as being 96x96. So what is a formula I can use for this? I was thinking one could get the pixels needed by multiplying the inches we want on the screen by the dpi of the screen, but this gives me the 168 mentioned above and obviously gets me no where.
Can anyone point me in the right direction, I'm honestly terrible with numbers and math so my apologies if I'm missing something simple or obvious.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确定显示器实际上是 96 ppi 吗?根据规格和我自己的计算,您的 Lenovo S10e 实际上的密度约为 116.36 ppi,这可能就是您的差异所在。
假设这些规格正确:
10.1 英寸对角线
1024 x 576 分辨率
16:9 屏幕比例(取自上述分辨率)
使用一些几何公式,您可以得到显示器的实际宽度和高度:
宽度:8.8"
高度:4.95"
除以 1024/8.8 和 576/4.95 得到每英寸 116.36 像素,而不是 96。
使用此值,168 像素图像应显示为 168/116.36 或 ~1.44",这与您的结果一致。我不会对 xdpyinfo 结果抱有太多信心。 :)
Are you sure that the display is actually 96 ppi? Going by the specs, and my own calculations, your Lenovo S10e actually has a density of ~116.36 ppi, which is probably where your difference is coming in.
Assuming these specs are correct:
10.1" diagonal
1024 x 576 resolution
16:9 screen ratio (taken from above resolution)
Using some geometric formulas, you can get the actual width and height of the monitor as:
Width: 8.8"
Height: 4.95"
Dividing 1024/8.8 and 576/4.95 gives you 116.36 pixels per inch, rather than 96.
Using this instead, a 168 pixel image should display as 168/116.36, or ~1.44", which is consistent with your results. I wouldn't put too much faith in the xdpyinfo results. :)