Image resolutions to supply for adaptive iOS app - ios

While developing an iOS app I invested a lot of time in making everything adaptive (size-classes and so on). I have implemented an few image scrollers / photo galleries that are screen wide and zoomable. What is the best practice related to multi-screen image storage and exposure?
It is not a problem to store or generate on the fly, let's say, five different resolutions for every image and load the best resolution depending on network connection and screen size. I want to know what is recommended for this sort of diversity.
This is a (perhaps incomplete) list of all the possible image resolutions based on screen size:
iPad landscape & portrait: 704px wide
iPad 2/3: 694px wide
iPad 1/2 landscape: 507px wide
iPad 1/2 portrait: 438px wide
iPhone 6+: 414px wide
iPhone 6: 375px wide
iPhone 4/5 + iPad split screen right-side: 320px wide
All my images are square. So height equals width.
Do I include retina photos or should I use #1x for photos? Do I add extra pixels for the zooming (1.5x max)?

This is are basically the current resolutions for iOS Devices.
Basically in the retina devices you need to provide #2x images if you want them to appear not pixelated. Also in the iPhone 6 Plus and 6s Plus you will need to provide #3x images.
In the following links you can find more information about it.
http://ivomynttinen.com/blog/the-ios-design-cheat-sheet-volume-2/
http://www.idev101.com/code/User_Interface/sizes.html

Related

what size should I choose to show fullscreen images in different 1x,2x,3x iPads

I am working on designing a universal (iPhone, iPad) application, this app is portrait only, and I want the application show some fullscreen images to users.
I edited my images size for (iPhone) like this in 1x=> 320*480px and 2x=> 750*1334px and for 3x=>1125*2436px.
now I am designing the app for different iPads. I searched a lot to find whats the best sizes for 1x and 2x and maybe 3x iPads but I couldn't find any exact pixels which I should choose for my images. its very important for me to show images with high quality and no and no stretch.
my question is what sizes in pixel should I choose for my images to shown in iPads perfectly.(full screen and portrait).
Appreciate any help.

How can I find the 'safe region' for iPhone size if I am creating my app using iPad size?

I am creating a game and want to use the iPad size settings (landscape: 1024x768). From what I've learnt, using the iPad settings will crop out part of the height only on an iPhone. Say I have a 2048x1536 background image for iPad (1024x768) and a 2208x1242 image for iPhone 6+ (736x414),
i. how can I determine the 'safe region' from the iPad that will appear on the iPhone 6+ both point and pixel wise?
ii. will the 'safe region' for the iPhone 6+ be the same as the iPhone 6 (667x375) with a 1334x750 image? If not, how can it also be determined both point and pixel wise?
I assume you wish to create a universal game that runs both on iPad and iPhone. If that's the case, there are two possible approaches when defining your graphics assets in the Attributes Inspector (far right on your Xcode interface while Assets.xcassets is selected). In the Devices section, you can select among Universal, iPhone, iPad, Apple Watch, Apple TV, Mac and any combination of those.
If you select "Universal" only, then you will have to make sure that the assets you insert there will look good both on iPhone and iPad. If that's the case, see below some hints of how to make your assets safe for using universally.
If you select "iPad" and "iPhone", you will have to include separate assets for iPad and iPhone, with their appropriate resolutions and aspect ratios. In my past experience, I've always headed this way. For the iPad (1x) you will have to provide a 1024x768 background, for the iPad (2x) you will have to provide a 2048x1536, unless you choose "Single Scale" and use a single vector PDF file. Respectively, for the iPhone, you will have to provide a 480x320 (1x, only in case you need to support old devices such as iPhone 3G/3GS, quite unlikely given the fact Sprite-Kit was introduced with iOS7), then 1334x750 (2x), and 2208x1242 (3x, for the iPhone 6+, 6S+, 7+). With this approach you don't need to worry about "safe" zones, as the graphics you supply will be used on each device properly with no "cutting" off the edge. Just bear in mind that iPhone 4S and iPhone 5/5S/SE would need some background scaling in order to fit the whole 2x picture on the screen. Otherwise it would look zoomed in.
If you go with the first approach, then you should consider the following information in order to make your "universal" graphics safe for use with all devices:
iPhone 5/5S/SE...and all newer have a 16:9 display aspect ratio.
iPhone 4S has 3:2 aspect ratio (you only worry about that if your game will support iOS 9).
iPad screen aspect ratio is 4:3.
With the above in mind, there are two paths you could go:
1. Use 16:9 universal assets that will have their left/right parts cut off on iPad and iPhone 4S.
2. Use 4:3 universal assets that will have their upper/lower parts cut off on iPhones.
The above applies to your 2x assets as these will be used for both retina iPads and retina iPhones (4S, 5/5S, SE, 6/6S/7).
1x assets will only be used for non-retina iPads (iPad 2 in case you would support iOS 9, otherwise skip these too).
3x assets will only be used for the "Plus" iPhone models. So I suggest you provide these in 16:9 ratio (2208x1242) only.
So, how do you calculate your "safe" zones. Pretty straightforward:
Case 1 (16:9 assets to be used for iPad too): height 1536 (this is the retina iPad height in pixels, although if you wish to be pixel-perfect on iPad Pro 12.9" then you should increase that to 2048), width = 1536 * 16 / 9 = 2732 pixels wide (3640 pixels for iPad Pro support). Note that you will have to scale it down in run-time in order to fit for the iPhones. In order to avoid cutting off important content from your background, don't put anything to the left or right of the middle 2048 pixels of the 2732x1536 universal image (342 pixel "danger" zones on the left and right). If you go with a 3640x2048 image (supporting iPad Pro 12.9"), then only use the middle 2732 pixels, leaving only unimportant stuff in the 454-pixel-wide left and right boundaries.
Case 1b (same as above but with a smaller image): Another approach would be to use a native (iPhone 6/6S/7) 1334/750 pixels image, but then you will have to scale up for iPads, and scale down for iPhone 4S/5/5S/SE. In this case, your "safe" zone is 1000x750 (visible both on 4:3 iPads and 16:9 iPhones).
Case 2 (4:3 assets to be used for iPhones too): For the 2x assets use 2048x1536 pixel images. Depending on how you position the sprite on the screen there will be loses on the upper and/or lower parts. If it's centered, then your "safe" zone is 2048 / 16 * 9 = 1152, which leads to 2048x1152 in the middle of the 2048x1536 asset.
If you need any further clarification I will be happy to elaborate.

iPhone #2x design in Sketch TROUBLE

I have already read a huge amount of posts and articles about iPhone screen sizes but can't find the info about next problem.
Recently i get a design made in sketch and artboard sizes are 640x1136 (and all the resources are so, like background image). As i can understand - designer heave made a design for iphone 5 - 4inch. And my designs are at 2x. Am i right?
Please see Sketch project Screen here!
So i want to export design for all iphones 4,5,6,6s plus.
Currently I'm developing my project with iphone 6s plus physical device.
But when i export designs in sketch as on a screenshoot - i get 3 images
320x568 px (exported as 0.5x)
640x1136 px (exported as 1x)
960x1704 px (exported as 1.5x)
And they doesn't fit for all devices when i add 3 images to Assets.xcassets.
Also i can export at 2x but i get 1280×2272px and it is bigger than iPhone 6s plus screen resolution.
What should i do to make this sketch designs work well on all iPhones, especially on my iPhone 6s plus? Maybe i can use only one image for all iPhones in xcode?
I believe the problem you are running into is that not all iPhone's have the same aspect ratio. Therefore, you can't simply scale the images to fit to all iPhones.
640 x 1136 is the right pixel resolution for the iPhone 5. However the iPhone 4 is 640 x 960 (shorter in height, but same width).
Depending on what the image is of (and therefore what looks better), you could either crop the images while exporting from Sketch, or stretch the image to fit all screen sizes.

What image sizes/retina sizes are necessary for iOS8 scaled app?

I'm building an app that designers only gave me one canvas size for (9x16 aspect ratio at 1242x2208). I started an app that doesn't fully leverage the iPhone 6+'s screen space. Instead, all devices will use the same layout and assets. I did this by removing the #3x launch screen image. The goal is to use the same point system for all devices (320x568 - including for iPhone 4S - the 320x568 will be in a scroll view to fit all the content since the app is designed for 9x16 aspect and the 4S is not).
With that said, for simplicity of the question, lets say I have a full screen image (320x568 points). What are the 3 necessary pixel resolutions I need for 1x, 2x, and 3x?
When I use an app like Prepo that takes a 3x image and scales it down to 2x and 1x automatically for me, this is what happens:
I add a 3x asset at 1242x2208. It spits out:
#2x with px dimensions of 828x1472
#1x with px dimensions of 414x736
That doesn't seem right to me, but then again the whole iOS retina resolutions thing confuses me quite a bit. Shouldn't the 1x resolution end up being 320x568?
It may be that you are mentally confusing apples with oranges. Let's say you have an app that is to run on both iPhone 4s and iPhone 6 Plus (the extremes). Then you have two concerns:
Resolution. The 4s screen has 2 pixels per point, while the 6 Plus screen has 3 pixels per point. Images must come in a 3x size for the 6 Plus and a 2x size for the 4s in order to look good on both screens. This is something that the Asset Catalog will help you with.
Layout. The two screens have different sizes and different proportions. Things will need to grow and shrink in order to fit nicely and look good on both. This is something that Auto Layout (constraints) will help you with.
The two things are both involved where images are to be displayed on the screen, but in two different ways. You will have different resolution images, and they will be displayed in differently sized UIImageViews that adjust the image's display size.

Using less Images for non-retina, retina and retina HD (#1x, #2x, #3x) for Universal Apps

To support iOS 7 to 8 on universal devices, I have to make 4 copies of the same image in different size.
For the iPhones
image#2x.png (iphone 4s,5,5s,6)
image#3x.png (iphone 6+)
For the iPads
image.png (ipad 2, ipad mini 1)
image#2x.png (ipad 3, 4, ipad mini 2, ipad Air)
The images are really bloating the app size.
Is it ok to just use 1 image size, the largest one of the set and scale to fit in the uiimageview and use the image view to scale down the image on the smaller screens?
imageView.contentMode = UIViewContentModeScaleAspectFit;
or is it absolutely necessary to have all 4 copies at different sizes?
It works on all the devices on the simulator and on a retina iPad 3, but I have no way of actual testing on other devices and am afraid that the images may not display.
Has anyone tried using 1 large image instead of the set of copies?
Yes, you can theoretically use the largest resolution image and have the UIImageView scale the image down using mode Aspect Fit.
The only drawback is the older phones that don't support retina also are less performant. For example, when using images on cells of a UITableView and scrolling, the device has to load the large image, then scale the image down, and scroll it at the same time, and it will stutter on old, slower devices.
So, perhaps just use multiple images in list views (should just be thumbnails and are tiny anyway, or just use the smaller images here), but don't worry about larger images that stay on the screen and don't scroll.
Make sure you load images in list views using methods that allow caching like imageNamed:.
As long as you take into consideration the performance penalties involved in scaling down the images, you can use just the largest image and scale it down to fit.
By the way, yes I've used this technique in real live apps in the App Store.
Another technique I've seen is to include lower quality images (1x or 2x) and if you run it on a higher resolution device (2x or 3x), automatically download high resolution images from the web. Maybe be nice about it and only download them on wifi.

Resources