Question

Is there a way in the iPhone SDK to calculate the size (in millimeters) of a single pixel?

Was it helpful?

Solution

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

OTHER TIPS

Answering the question as asked about the size of pixels:

Pixel size on an iPhone and iPod Touch

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

  2. The first three iPod touch generations stated the same 163 ppi.

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

  4. The fourth generation iPod touch (Sept 2010) has specs the same as the iPhone 4, 960-by-640-pixel resolution at 326 ppi

  5. The iPhone 4S (Oct 2011) is unchanged from the iPhone 4 in terms of resolution.

  6. The iPhone 5 (Sept 2012) specs said 1136-by-640 pixel resolution at 326 ppi. Pixel size is unchanged. Screen diagonal is 4 inches.

  7. The iPhone 5C and iPhone 5S (Sept 2013) have the same resolution, pixel size, and diagonal as the iPhone 5.

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

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

  1. The iPad 1 and 2 are 9.7 inch (diagonal) display with 1024-by-768-pixel resolution at 132 ppi per the iPad specs. That is about .0075758 inches per pixel or 0.1924 mm per pixel.

  2. The new iPad (March 2012) is a 9.7 inch (diagonal) display with 2048-by-1536-pixel resolution at 264 ppi per the current iPad specs. That is about .0037879 inches per pixel or 0.09621 mm per pixel.
  3. The iPad Mini (1st generation - October 2012) is a 7.9 inch (diagonal) display with a 1024-by-768-pixel resolution at 163 ppi per the original iPad mini specs. That is about .006135 inches per pixel or 0.156 mm per pixel.
  4. The iPad Mini 2 (2nd generation - October 2013) is a 7.9 inch (diagonal) display with a 2048-by-1536-pixel resolution at 326 ppi per the current iPad mini specs. That is about .0030675 inches per pixel or 0.0779 mm per pixel.
  5. 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top