计算 iPhone 上的像素大小
iPhone SDK中有没有办法计算单个像素的大小(以毫米为单位)?
Is there a way in the iPhone SDK to calculate the size (in millimeters) of a single pixel?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
回答有关像素大小的问题:
iPhone 和 iPod Touch 上的像素大小
早期的 iPhone(iPhone 之前的版本) 4) Apple iPhone 技术规格称:480 x 320 像素分辨率,每英寸 163 像素(ppi)。 每像素大约 0.006135 英寸或每像素 0.1558282 毫米。
前三代 iPod touch 的分辨率相同为 163 ppi。
iPhone 4 规格称分辨率为 960 x 640 像素,326 ppi 。 因此,像素宽度为 1 英寸/每英寸 326 像素,或者大约每像素 0.003067 英寸或每像素 0.0779 毫米。 您使用的是点,而不是像素。 编辑:正如下面奥拉夫评论中所指出的,像素实际上是可寻址的,使用半点。
第四代 iPod touch(2010 年 9 月)已
规格与 iPhone 4 相同,960 x 640 像素分辨率 326 ppi
iPhone 4S(2011 年 10 月)在分辨率方面与 iPhone 4 相比没有变化。
iPhone 5(2012 年 9 月)规格称分辨率为 1136 x 640 像素,326 ppi。 像素大小不变。 屏幕对角线为 4 英寸。
iPhone 5C 和 iPhone 5S(2013 年 9 月)与 iPhone 5 具有相同的分辨率、像素大小和对角线。
iPhone 6,4.7英寸,(2014 年 9 月)
规格 为 1334-by-750 - 像素分辨率,
每英寸 326 像素 (ppi)。 像素大小从 4、4S、5 5s 不变。
iPhone 6 Plus,5.5 英寸,(2014 年 9 月)
规格 为 1920 年 x 1080 年- 像素分辨率,
每英寸像素 (ppi) 401。 像素尺寸大约小 20%。 像素宽度为 1 英寸/每英寸 401 个像素或大约每像素 0.002494 英寸或每像素 0.06334 毫米。
iPad 上的像素大小
根据当前的 iPad 规格。
这大约是每像素 0.0037879 英寸或每像素 0.09621 毫米。
每像素 0.006135 英寸或每像素 0.156 毫米。
每像素 0.0030675 英寸或每像素 0.0779 毫米。
iPad Air 2(2014 年 10 月)和 iPad Mini 3(2014 年 10 月)与这些产品的先前版本具有相同的分辨率、像素大小和对角线。
iPad Air 与 iPad Air 2、iPad Mini、iPad 2 和 iPad3 的比较。
您不需要让 iPhone SDK 计算单个像素的大小。 一种选择是 确定您所运行的设备,然后选择所需的毫米尺寸。
具有 3.5 英寸(对角线)显示屏的 iPhone(直至并包括 4S)/iPod Touch 屏幕尺寸不完全是 2 英寸 x 3 英寸。 它们比那小一点点。 iPhone 5 配备 4 英寸(对角线)显示屏。
提问者实际上可能需要什么:分数。
请参阅删除者对上一个答案的评论。 坐标以点而非像素指定。
Answering the question as asked about the size of pixels:
Pixel size on an iPhone and iPod Touch
The earlier iPhones (pre-iPhone 4) Apple iPhone Technical Specifications said : 480-by-320-pixel resolution at 163 pixels per inch(ppi). About 0.006135 inches per pixel or 0.1558282 mm per pixel.
The first three iPod touch generations stated the same 163 ppi.
The iPhone 4 specs said 960-by-640-pixel resolution at 326 ppi . So pixel width is 1 inch / 326 pixels per inch or about 0.003067 inches per pixel or 0.0779 mm per pixel. You use points, not pixels. Edit: As noted in Olaf's comment, below, pixels are actually addressable, using half-points.
The fourth generation iPod touch (Sept 2010) has
specs the same as the iPhone 4, 960-by-640-pixel resolution at 326 ppi
The iPhone 4S (Oct 2011) is unchanged from the iPhone 4 in terms of resolution.
The iPhone 5 (Sept 2012) specs said 1136-by-640 pixel resolution at 326 ppi. Pixel size is unchanged. Screen diagonal is 4 inches.
The iPhone 5C and iPhone 5S (Sept 2013) have the same resolution, pixel size, and diagonal as the iPhone 5.
The iPhone 6, 4.7 inch, (Sept 2014)
specs are 1334-by-750-pixel resolution,
at 326 pixels per inch (ppi). pixel size is unchanged from 4, 4S, 5 5s.
The iPhone 6 Plus, 5.5 inch, (Sept 2014)
specs are 1920-by-1080-pixel resolution,
at 401 pixels per inch (ppi). pixel size is about 20% smaller. The pixel width is 1 inch / 401 pixels per inch or about 0.002494 inches per pixel or 0.06334 mm per pixel.
Pixel size on an iPad
per the current iPad specs.
That is about .0037879 inches per pixel or 0.09621 mm per pixel.
.006135 inches per pixel or 0.156 mm per pixel.
.0030675 inches per pixel or 0.0779 mm per pixel.
The iPad Air 2 (October 2014) and the iPad Mini 3 (October 2014) have the same resolution, pixel size, and diagonal as the previous versions of those products.
Comparison of the iPad Air, and iPad Air 2, iPad Mini, iPad 2 and iPad3.
You don't need to have the iPhone SDK calculate the size of a single pixel. One option is to determine what you are running on and then select the needed mm size.
The iPhone (up to and including the 4S) / iPod Touch screen sizes, with a 3.5 inch (diagonal) display are NOT exactly 2" x 3". They are a tiny bit smaller than that. The iPhone 5 has a 4 inch (diagonal) display.
What the questioner may actually need: points.
See Removers comment to the previous answer. Coordinates are specified in points, not pixels.
嗯,像素的大小是一个常数。 当前 iPhone 或 iPod touch 的屏幕尺寸为 2" x 3" (50.8 mm x 76.2 mm),分辨率为 320 x 480 像素。
50.8 / 320 (或 76.2 / 480) => 1 像素的尺寸为 0.15875 毫米 x 0.15875 毫米
Well, the size of a pixel is a constant. The screen size of a current iPhone or iPod touch 2" x 3" (50.8 mm x 76.2 mm) and the resolution is 320 x 480 pixel.
50.8 / 320 (or 76.2 / 480) => the size of 1 pixel is 0.15875 mm x 0.15875 mm