IOS 8 asset catalog image sizes confusing - ios

Say I want to make a button that takes up half the width of the iPhone screen (portrait) at #1x. This would be 160 pixels, #2x this would be 320 pixels.
Now with iPhone 6 and iPhone 6 plus it gets confusing. The iPhone 6 has 750 pixels width and uses #2x but the asset catalog has only one box for adding #2x images, so do I make my image 320 pixels or 375 pixels?
Also, the iPhone 6 Plus has width of 1080 pixels or 1242 pixels (any idea which one?), but my standard image of 160 pixels multiplied by 3 = 480 pixels but half the iPhone 6 Plus screen is either 540 pixels or 621 pixels??
What size I should be making my images and why?

The iPhone 6 and 6 Plus have the same aspect ration as the iPhone 5/5C/5S, so they automatically scale the image for your screen. For the iPhone 6, your image should be 320 pixels, just like with a 4-inch screen.
For the 6 Plus, you should make it 480 pixels for the same reason.

Related

#3x image, Iphone 8 Plus, Iphone X

Let's assume, I have selected 'View as: iPhone 8 Plus' on Main.storyboard in Xcode. We know these details:
Iphone X: 375 x 812 points (#3x) 1125x2436 pixels
Iphone 8 Plus: 414 x 736 points (#3x) 1242 × 2208 pixels
Iphone 8: 375 x 667 points (#2x) 750x1334 pixel
Let's assume I would like to put an UIImageView (top bar, header bar image) like below:
Remember, I have selected 'View as: iPhone 8 Plus'. So width of the image must be 414 points. And let's assume height of the image is 100 points. So image size must be 1242 x 300 pixels. (because 414points*3=1242px, 100points*3=300px)
so,
#3xBackground.png must be 1242 x 300 pixels.
#2xBackground.png must be 828x200, right? **(this is question 1)**
#1xBackground.png must be 414x100, right? **(this is question 2)**
What about IPhone X? Iphone X also uses #3xBackground.png image, right? (this is question3)
I see this image so sharp at iphone 8 plus. Because I create this image regarding to the iPhone 9 plus. But i can't see this image so sharp in iPhone x. Because width of iPhone X is 375points(1125 pixels) but my image width is 414 points(1242 pixels) Am i right? iphone x and iphone 8 plus use same image: #3xBackground.png. Device tries to put 1242pixel image in to 1125 px place. So how does this picture look so sharp?
Does Iphone X reduce height of the image when it puts 1242 pixel image in to 1125 px place ? (This is question 4) If reply yes. So it should be fine.

Iphone 5 - 6plus image size/resolutions?

I'm working on the graphics for an app that will run in portrait mode only for the iPhone 5 - 6 plus. The images should be the total width of the portrait screen. Based on this page:
http://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions it looks as if my image widths should be as follows:
x = 640 pixels in width,
2x = 750 pixels in width,
3x = 1125 pixels in width
Does the above look correct?
When creating these images in Photoshop is it best to save them at 72 ppi?
Thank you for your assistance.
Not sure why your refer to them as "x", "2x" and "3x", but the screen widths (native for iPhone 4/5/6, virtual for 6 Plus) are:
640 pixels (iPhone 4/5)
750 pixels (iPhone 6)
1242 pixels (iPhone 6 Plus)
The ppi resolution doesn't matter if you set the sizes in pixels. It only matters if you set the size in cm, inches or similar length units. If you want to see them at their "real" size, you should select 326 ppi for iPhone 4/5/6 and 461 ppi for 6 Plus.

What pixel size do images need to at least fill the iPhone 6 Plus display?

The iPhone 6 Plus has 414 x 736 points. It renders at 3x to get 1242 x 2208 pixels, which are mapped to 1080 x 1920 of physical pixel.
Since the physical pixels are the pixels which are actually drawn and shown to the user, I guess that full screen images have to be at least 1080 x 1920 px to match the full screen potential. Each image which is bigger than that will be downscaled to 1080 x 1920 px.
Am I right that you need at least have full screen images in size 1080 x 1920 px to get the best resolution on an iPhone 6 Plus?
Do not confuse with 'mapped to physical size'. You just use 1242 x 2208 px size for you full screen images.
The screen bounds of iPhone6+ is;
NSLog("Screen Size \( UIScreen.mainScreen().bounds)"); // on iPhone 6+ - 414 x 736 (1x)
Which we are using in our development calculations so,
in development, there is no concept of physical screen size. it is handled by the device at its own.

How to resize image assets for all Apple devices? (not launch images)

My app displays 2 buttons on the top and a car picture (1 of 4 possible) at the bottom:
Each image file has huge dimensions of 5616 x 3744 pixels and the app lags noticeably and also sometimes crashes (here fullscreen, Aspect Fill mode is used):
So I would like to scale down the image assets and include these files (for each of the 4 car pictures) in my app:
car.jpg
car#2x.jpg
car#3x.jpg
After searching around and I think I have to target the Rendered Pixels sizes, that is:
640 x 960 for iPhone 4
640 x 1136 for iPhone 5
750 x 1334 for iPhone 6
1242 x 2208 for iPhone 6 Plus
and I have yet to look up the dimensions of iPads
However my image view has 20 pixels insets (here fullscreen):
So I am not sure, which value to subtract from the widths of car.jpg, car#2x.jpg and car#3x.jpg.
Should I subtract 40 pixels from each file (that is 20 on the left and 20 on the right)?
just resize the image to the largest it will be (#3x) - it will be significantly smaller than it is at the moment, aspect fill will take care of the rest

How does my app currently behaves on an iPhone 6 / iPhone 6 plus?

I got the following numbers for iPhone devices, from PaintCodeApp website
Device Zoom display Points Rendered pixels Scale
W H W H
iPhone 6 Plus Off 414 736 1242 2208 #3x
iPhone 6 Plus On 375 667 1125 2001 #3x
iPhone 6 Off 375 667 750 1334 #2x
iPhone 6 On 320 568 640 1136 #2x
iPhone 5 - 320 568 640 1136 #2x
iPhone 4 - 320 480 640 960 #2x
iPhone 3GS - 320 480 320 480 #1x
Since my apps were designed for iPhone 3GS up to iPhone 5, the supported points frames are 320x480#1x, 320x480#2x and 320x568#2x.
I assume that on an iPhone 6 with the zoom mode enabled, the display should be the exact same as the iPhone 5, since the points frame is 320x568#2x as well. This might be wrong, since I cannot find no confirmation.
Now, what I'm really wondering is how my apps shows on iPhone 6 with the zoom mode off, and on iPhone 6 plus with or without the zoom mode, since the points frames are 375x667#2x, 375x667#3x and 414x736#3x.
Apple Developer Support couldn't give me no hint nor documentation to read on the subject. Since I haven't bought the new devices, is there anyone who knows what actually happens with old apps ?
For those like me who wonder how are treated legacy apps, I did a bit of testing and computation on the subject.
Thanks to #hannes-sverrisson hint, I started on the assumption that a legacy app is treated with a 320x568 view in iPhone 6 and iPhone 6 plus.
The test was made with a simple black background bg#2x.png with a white border. The background has a size of 640x1136 pixels, it is black with an inner white border of 1px.
Below are the screenshots provided by the simulator :
iPhone 5 simulator : http://i.stack.imgur.com/b2E5K.png
iPhone 6 simulator : http://i.stack.imgur.com/4Qz8N.png
iPhone 6 plus simulator : http://i.stack.imgur.com/hQisc.png
What we can see on the iPhone 6 screenshot is a 1px margin on top and bottom of the white border, and a 2px margin on the iPhone 6 plus screenshot. This gives us a used space of 1242x2204 on iPhone 6 plus, instead of 1242x2208, and 750x1332 on the iPhone 6, instead of 750x1334.
We can assume that those dead pixels are meant to respect the iPhone 5 aspect ratio :
iPhone 5 640 / 1136 = 0.5634
iPhone 6 (used) 750 / 1332 = 0.5631
iPhone 6 (real) 750 / 1334 = 0.5622
iPhone 6 plus (used) 1242 / 2204 = 0.5635
iPhone 6 plus (real) 1242 / 2208 = 0.5625
Second, it is important to know that #2x resources will be scaled not only on iPhone 6 plus (which expects #3x assets), but also on iPhone 6. This is probably because not scaling the resources would have led to unexpected layouts, due to the enlargment of the view.
However, that scaling is not equivalent in width and height. I tried it with a 264x264 #2x resource. Given the results, I have to assume that the scaling is directly proportionnal to the pixels / points ratio.
Device Width scale Computed width Screenshot width
iPhone 5 640 / 640 = 1.0 264 px
iPhone 6 750 / 640 = 1.171875 309.375 309 px
iPhone 6 plus 1242 / 640 = 1.940625 512.325 512 px
Device Height scale Computed height Screenshot height
iPhone 5 1136 / 1136 = 1.0 264 px
iPhone 6 1332 / 1136 = 1.172535 309.549 310 px
iPhone 6 plus 2204 / 1136 = 1.940141 512.197 512 px
It's important to note the iPhone 6 scaling is not the same in width and height (309x310). This tends to confirm the above theory that scaling is not proportional in width and height, but uses the pixels / points ratio.
I hope this helps.

Resources