Is there a way in the iPhone SDK to calculate the size (in millimeters) of a single pixel?
Get the Actual Pixels App from the App Store. It's free and will tell you the pixel size of any photo you open.
The width and height of the image in pixels. To find the total number of pixels, multiply the width and height together. In this case, 4700 pixels x 3133 pixels = 14,725,100 pixels. That's a lot of pixels.
The pixel width is 1 inch / 401 pixels per inch or about 0.002494 inches per pixel or 0.06334 mm per pixel.
The iPhone 11 comes in a single screen size of 6.1 inches with a resolution of 1792‑by‑828‑pixel resolution at 326 ppi.
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
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With